无法执行目标 org.springframework.boot:spring-boot-maven-plugin:1.5.6.RELEASE

Vus*_*ala 3 java spring maven

我是 spring boot 的新手,尝试解决这个问题一周。我下载plugin并仍然收到相同的错误,如果需要,我没有代理的工具/选项

编辑 我刚刚创建了一个用户可以注册或登录的基本项目。我有控制器、服务存储库、域类。但是当我想检查我的数据库是否创建时,我收到了这个错误。我检查了我plugins是否错过了一些但是一切似乎都正确。你能给我一些猜测可能是什么问题吗?

我的 pom.xml

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.6.RELEASE</version>
    <relativePath/>
    <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>javax.persistence</artifactId>
        <version>2.1.0</version>
        <type>jar</type>
    </dependency>
    
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-commons</artifactId>
        <version>1.13.6.RELEASE</version>
        <type>jar</type>
    </dependency>
    
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>1.11.6.RELEASE</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>1.5.6.RELEASE</version>
        <type>jar</type>
    </dependency>
</dependencies>

<build>
    <plugins>
        
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>1.5.6.RELEASE</version>
            <configuration>
                <fork>true</fork>
            </configuration>
        </plugin>
        
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

安慰

Description:

Field `userRepository` in `com.example.service.UserService` required a bean named 'entityManagerFactory' that could not be found.


Action:

Consider defining a bean named 'entityManagerFactory' in your configuration.
Run Code Online (Sandbox Code Playgroud)

小智 9

只需将以下代码添加到您的pom.xml

100% 工作

<build>
<plugins>
 <plugin>
  <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
         <configuration>
            <skip>true</skip>
         </configuration>
         <executions>
            <execution>
               <phase>none</phase>
            </execution>
         </executions>
      </plugin>
   </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)


Mic*_*eco 6

我面临同样的问题,但在不同的情况下。我有一个 Maven 多模块项目。我的核心模块继承自另一个使用spring-boot-maven-plugin:2.1.2.RELEASE插件的模块。当我尝试编译核心模块时,发生了同样的错误:

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.2.RELEASE:repackage (repackage) on project it-core
Run Code Online (Sandbox Code Playgroud)

我认为出现问题是因为我的核心模块没有@SpringBootApplication主类。

以下解决方案解决了我的问题。

<build>
   <plugins>
      <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
         <configuration>
            <skip>true</skip>
         </configuration>
         <executions>
            <execution>
               <phase>none</phase>
            </execution>
         </executions>
      </plugin>
      <plugin>
         <groupId>com.google.cloud.tools</groupId>
         <artifactId>jib-maven-plugin</artifactId>
         <configuration>
            <skip>true</skip>
         </configuration>
      </plugin>
   </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

也许你不需要 jib-maven-plugin