【发布时间】:2016-06-20 14:22:35
【问题描述】:
我有一个可以在 Eclipse 中运行的 maven 项目,但我无法从 linux 命令行运行它。运行 'mvn spring-boot:run' 时出现错误:
“在当前项目和存储库中可用的插件组 [org.apache.maven.plugins, org.codehaus.mojo] 中找不到前缀“spring-boot”的插件”
这是我的 POM:
<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>
<groupId>com.example</groupId>
<artifactId>project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
</parent>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<arguments>
<argument>--spring.profiles.active=prod</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
【问题讨论】:
-
你确定从这个 pom 所在的目录启动命令吗?
-
直到我最终尝试了完整的命令“mvn org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:run”,我才知道我应该这样做,这使得错误更改为告诉我我需要从 POM 目录运行命令。我试过了,但现在我又遇到了第三个错误。这很有趣。
标签: java linux maven spring-boot