猿问

Spring boot 2 lombok:jar:2.6.7 丢失,没有可用的依赖信息

这是我pom.xml从 start.spring.io 生成的 M2 spring-boot 版本。这就是添加 maven spring 存储库的原因。但是找不到依赖项。


    <?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>

        <groupId>org.springframework.boot</groupId>

        <artifactId>spring-boot-starter-parent</artifactId>

        <version>2.2.0.M2</version>

        <relativePath/> <!-- lookup parent from repository -->

    </parent>

    <groupId>com.example</groupId>

    <artifactId>auth-service</artifactId>

    <version>0.0.1-SNAPSHOT</version>

    <name>auth-service</name>

    <description>Authorization service</description>


    <properties>

        <java.version>11</java.version>

    </properties>


    <dependencies>

        <dependency>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-starter-security</artifactId>

        </dependency>

        <dependency>

            <groupId>com.okta.spring</groupId>

            <artifactId>okta-spring-boot-starter</artifactId>

            <version>1.1.0</version>

        </dependency>


        <dependency>

            <groupId>org.springframework.security.oauth</groupId>

            <artifactId>spring-security-oauth2</artifactId>

            <version>2.3.5.RELEASE</version>

        </dependency>

        <dependency>

            <groupId>org.projectlombok</groupId>

            <artifactId>lombok</artifactId>

            <version>2.6.7</version>

        </dependency>


人到中年有点甜
浏览 147回答 1
1回答

潇潇雨雨

我从 start.spring.io 下载了一个类似的 spring 项目 - 2.2.0.M2,具有类似的依赖项。下面是我的 pom.xml 文件<modelVersion>4.0.0</modelVersion><parent>&nbsp; &nbsp; <groupId>org.springframework.boot</groupId>&nbsp; &nbsp; <artifactId>spring-boot-starter-parent</artifactId>&nbsp; &nbsp; <version>2.2.0.M2</version>&nbsp; &nbsp; <relativePath/> <!-- lookup parent from repository --></parent><groupId>com.example</groupId><artifactId>demo</artifactId><version>0.0.1-SNAPSHOT</version><name>demo</name><description>Demo project for Spring Boot</description><properties>&nbsp; &nbsp; <java.version>11</java.version></properties><dependencies>&nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.springframework.boot</groupId>&nbsp; &nbsp; &nbsp; &nbsp; <artifactId>spring-boot-starter-oauth2-client</artifactId>&nbsp; &nbsp; </dependency>&nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.springframework.boot</groupId>&nbsp; &nbsp; &nbsp; &nbsp; <artifactId>spring-boot-starter-security</artifactId>&nbsp; &nbsp; </dependency>&nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; <groupId>com.okta.spring</groupId>&nbsp; &nbsp; &nbsp; &nbsp; <artifactId>okta-spring-boot-starter</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; <version>1.1.0</version>&nbsp; &nbsp; </dependency>&nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.projectlombok</groupId>&nbsp; &nbsp; &nbsp; &nbsp; <artifactId>lombok</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; <optional>true</optional>&nbsp; &nbsp; </dependency>&nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.springframework.boot</groupId>&nbsp; &nbsp; &nbsp; &nbsp; <artifactId>spring-boot-starter-test</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; <scope>test</scope>&nbsp; &nbsp; </dependency>&nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.springframework.security</groupId>&nbsp; &nbsp; &nbsp; &nbsp; <artifactId>spring-security-test</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; <scope>test</scope>&nbsp; &nbsp; </dependency></dependencies><build>&nbsp; &nbsp; <plugins>&nbsp; &nbsp; &nbsp; &nbsp; <plugin>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.springframework.boot</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>spring-boot-maven-plugin</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; </plugin>&nbsp; &nbsp; </plugins></build><repositories>&nbsp; &nbsp; <repository>&nbsp; &nbsp; &nbsp; &nbsp; <id>spring-snapshots</id>&nbsp; &nbsp; &nbsp; &nbsp; <name>Spring Snapshots</name>&nbsp; &nbsp; &nbsp; &nbsp; <url>https://repo.spring.io/snapshot</url>&nbsp; &nbsp; &nbsp; &nbsp; <snapshots>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <enabled>true</enabled>&nbsp; &nbsp; &nbsp; &nbsp; </snapshots>&nbsp; &nbsp; </repository>&nbsp; &nbsp; <repository>&nbsp; &nbsp; &nbsp; &nbsp; <id>spring-milestones</id>&nbsp; &nbsp; &nbsp; &nbsp; <name>Spring Milestones</name>&nbsp; &nbsp; &nbsp; &nbsp; <url>https://repo.spring.io/milestone</url>&nbsp; &nbsp; </repository></repositories><pluginRepositories>&nbsp; &nbsp; <pluginRepository>&nbsp; &nbsp; &nbsp; &nbsp; <id>spring-snapshots</id>&nbsp; &nbsp; &nbsp; &nbsp; <name>Spring Snapshots</name>&nbsp; &nbsp; &nbsp; &nbsp; <url>https://repo.spring.io/snapshot</url>&nbsp; &nbsp; &nbsp; &nbsp; <snapshots>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <enabled>true</enabled>&nbsp; &nbsp; &nbsp; &nbsp; </snapshots>&nbsp; &nbsp; </pluginRepository>&nbsp; &nbsp; <pluginRepository>&nbsp; &nbsp; &nbsp; &nbsp; <id>spring-milestones</id>&nbsp; &nbsp; &nbsp; &nbsp; <name>Spring Milestones</name>&nbsp; &nbsp; &nbsp; &nbsp; <url>https://repo.spring.io/milestone</url>&nbsp; &nbsp; </pluginRepository></pluginRepositories>做了一个mvn clean compile,可以看到依赖项被下载到我的 .m2 文件夹并且构建成功。下面是一个示例 Lombok 注释package com.example.demo;import lombok.Value;@Valuepublic class User {&nbsp; &nbsp; String firstName;&nbsp; &nbsp; String lastName;}以下是我的主要课程:@SpringBootApplicationpublic class DemoApplication implements CommandLineRunner {&nbsp; &nbsp; public static void main(String[] args) {&nbsp; &nbsp; &nbsp; &nbsp; SpringApplication.run(DemoApplication.class, args);&nbsp; &nbsp; }&nbsp; &nbsp; @Override&nbsp; &nbsp; public void run(String... args) {&nbsp; &nbsp; &nbsp; &nbsp; User user = new User("Hello", "World");&nbsp; &nbsp; &nbsp; &nbsp; System.out.println("First Name: " + user.getFirstName());&nbsp; &nbsp; &nbsp; &nbsp; System.out.println("Last Name: " + user.getLastName());&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(user.toString());&nbsp; &nbsp; }}下面是输出:2019-04-28 10:33:58.649&nbsp; INFO 8732 --- [&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;main] com.example.demo.DemoApplication&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: No active profile set, falling back to default profiles: default2019-04-28 10:34:01.069&nbsp; INFO 8732 --- [&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;main] com.example.demo.DemoApplication&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Started DemoApplication in 3.824 seconds (JVM running for 6.822)First Name: HelloLast Name: WorldUser(firstName=Hello, lastName=World)Process finished with exit code&nbsp;
随时随地看视频慕课网APP

相关分类

Java
我要回答