Spring Boot Missing Plugin when Running from Command Line

3k Views Asked by At

I have a maven project that I can run in Eclipse, but I can't get it to run from the linux command line. I get an error when I run 'mvn spring-boot:run':

"No plugin found for prefix 'spring-boot' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories"

Here is my 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>
2

There are 2 best solutions below

0
mcgregors On BEST ANSWER

I ended up using the full command "mvn org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:run", which worked for some reason when I ran it from the directory containing the pom.xml file.

0
walen On

Have you tried to run your application from the jar instead? If you are using Spring Boot's maven plugin as explained here, you should be able to just java -jar your-jar-file.jar, no need to use maven.