插件 org.springframework.boot:spring-boot-maven-plugin:1.3.0.BUILD-SNAPSHOT 或其依赖项之一无法解析
Posted
技术标签:
【中文标题】插件 org.springframework.boot:spring-boot-maven-plugin:1.3.0.BUILD-SNAPSHOT 或其依赖项之一无法解析【英文标题】:Plugin org.springframework.boot:spring-boot-maven-plugin:1.3.0.BUILD-SNAPSHOT or one of its dependencies could not be resolved 【发布时间】:2015-07-12 09:10:54 【问题描述】:我遇到以下错误:
:找不到工件 org.springframework.boot:spring-boot-maven -plugin:jar:1.3.0.BUILD-SNAPSHOT
我的 pom.xml 文件是:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.BBMSearchApp</groupId>
<artifactId>adder</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>adder Maven Webapp</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.BUILD-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.7.0.RELEASE</version>
</dependency>
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j</artifactId>
</dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20141113</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-social-facebook</artifactId>
</dependency> -->
<!-- <dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-compiler-2.1</artifactId>
<version>2.1.5</version>
</dependency> -->
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.4</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<!-- <dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-compiler-2.1</artifactId>
<version>2.1.5</version>
</dependency> -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.9.30</version>
</dependency>
</dependencies>
<build>
<finalName>adder</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>
调试日志是:
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T22:59:23+05:30)
Maven home: C:\Dev\apache-maven-withCustomReposiory\apache-maven-3.2.5
Java version: 1.8.0_11, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_11\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from C:\Dev\apache-maven-withCustomReposiory\apache-maven-3.2.5\conf\settings.xml
[DEBUG] Reading user settings from C:\Dev\apache-maven-withCustomReposiory\apache-maven-3.2.5\conf\settings.xml
[DEBUG] Using local repository at C:\Users\DK\.m2Custom\repo
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\DK\.m2Custom\repo
[INFO] Scanning for projects...
[DEBUG] Could not find metadata org.springframework.boot:spring-boot-starter-parent:1.3.0.BUILD-SNAPSHOT/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[DEBUG] Skipped remote request for org.springframework.boot:spring-boot-starter-parent:1.3.0.BUILD-SNAPSHOT/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Could not find metadata org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[DEBUG] Skipped remote request for org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Extension realms for project com.BBMSearchApp:adder:war:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging war from ClassRealm[plexus.core, parent: null]
[DEBUG] Could not find metadata org.springframework:spring-framework-bom:4.2.0.BUILD-SNAPSHOT/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[DEBUG] Skipped remote request for org.springframework:spring-framework-bom:4.2.0.BUILD-SNAPSHOT/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Could not find metadata org.springframework.integration:spring-integration-bom:4.2.0.BUILD-SNAPSHOT/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[DEBUG] Skipped remote request for org.springframework.integration:spring-integration-bom:4.2.0.BUILD-SNAPSHOT/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Extension realms for project org.springframework.boot:spring-boot-starter-parent:pom:1.3.0.BUILD-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Could not find metadata org.springframework:spring-framework-bom:4.2.0.BUILD-SNAPSHOT/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[DEBUG] Skipped remote request for org.springframework:spring-framework-bom:4.2.0.BUILD-SNAPSHOT/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Could not find metadata org.springframework.integration:spring-integration-bom:4.2.0.BUILD-SNAPSHOT/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[DEBUG] Skipped remote request for org.springframework.integration:spring-integration-bom:4.2.0.BUILD-SNAPSHOT/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Could not find metadata org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[DEBUG] Skipped remote request for org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Extension realms for project org.springframework.boot:spring-boot-dependencies:pom:1.3.0.BUILD-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Resolving plugin prefix spring-boot from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Could not find metadata org.springframework.boot:spring-boot-maven-plugin:1.3.0.BUILD-SNAPSHOT/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[DEBUG] Could not find metadata org.springframework.boot:spring-boot-maven-plugin:1.3.0.BUILD-SNAPSHOT/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[WARNING] The POM for org.springframework.boot:spring-boot-maven-plugin:jar:1.3.0.BUILD-SNAPSHOT is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.springframework.boot:spring-boot-maven-plugin:1.3.0.BUILD-SNAPSHOT: Plugin org.springframework.boot:spring-boot-maven-plugin:1.3.0.BUILD-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact org.springframework.boot:spring-boot-maven-plugin:jar:1.3.0.BUILD-SNAPSHOT
org.apache.maven.plugin.PluginResolutionException: Plugin org.springframework.boot:spring-boot-maven-plugin:1.3.0.BUILD-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact org.springframework.boot:spring-boot-maven-plugin:jar:1.3.0.BUILD-SNAPSHOT
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:133)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:150)
at org.apache.maven.plugin.DefaultBuildPluginManager.loadPlugin(DefaultBuildPluginManager.java:81)
at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolveFromProject(DefaultPluginPrefixResolver.java:138)
at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolveFromProject(DefaultPluginPrefixResolver.java:125)
at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolve(DefaultPluginPrefixResolver.java:85)
at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.findPluginForPrefix(MojoDescriptorCreator.java:260)
at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:220)
at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:103)
at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:83)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:85)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact org.springframework.boot:spring-boot-maven-plugin:jar:1.3.0.BUILD-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
... 24 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.springframework.boot:spring-boot-maven-plugin:jar:1.3.0.BUILD-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:434)
... 28 more
[DEBUG] Could not find metadata org.apache.maven.plugins/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[DEBUG] Skipped remote request for org.apache.maven.plugins/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Could not find metadata org.codehaus.mojo/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[DEBUG] Skipped remote request for org.codehaus.mojo/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Could not find metadata org.apache.maven.plugins/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[DEBUG] Could not find metadata org.codehaus.mojo/maven-metadata.xml in local (C:\Users\DK\.m2Custom\repo)
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repo.maven.apache.org/maven2
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repo.maven.apache.org/maven2
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.maven.apache.org/maven2
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
[INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (13 KB at 4.8 KB/sec)
[DEBUG] Writing tracking file C:\Users\DK\.m2Custom\repo\org\apache\maven\plugins\resolver-status.properties
[INFO] Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 KB at 6.9 KB/sec)
[DEBUG] Writing tracking file C:\Users\DK\.m2Custom\repo\org\codehaus\mojo\resolver-status.properties
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.313 s
[INFO] Finished at: 2015-05-02T23:05:55+05:30
[INFO] Final Memory: 15M/208M
[INFO] ------------------------------------------------------------------------
[ERROR] 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 [local (C:\Users\DK\.m2Custom\repo), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: 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 [local (C:\Users\DK\.m2Custom\repo), central (https://repo.maven.apache.org/maven2)]
at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolve(DefaultPluginPrefixResolver.java:93)
at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.findPluginForPrefix(MojoDescriptorCreator.java:260)
at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:220)
at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:103)
at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:83)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:85)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException
【问题讨论】:
你请求的依赖spring-boot-maven-plugin
在这个版本中根本不存在
【参考方案1】:
添加版本部分,它适用于我
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.2.7.RELEASE</version>
</plugin>
</plugins>
</build>
【讨论】:
OP 专门尝试使用 spring 1.3,因此使用 1.2.7 并不是真正的解决方案。【参考方案2】:您必须将以下摘录添加到 pom.xml
以使用 SNAPSHOTS 和 MILESTONES 进行编译:
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
【讨论】:
【参考方案3】:你可以参考这个 pom.xml 来获取分辨率。 @acoder2013 所说的完全正确。 :)
http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
<groupId>Springboot</groupId>
<artifactId>com.spring.services</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<pluginRepositories>
<pluginRepository>
<id>repository.spring.release</id>
<name>Spring GA Repository</name>
<url>https://repo.spring.io/plugins-release/</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>repository.spring.milestone</id>
<name>Spring Milestone Repository</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.2.7.RELEASE</version>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
【讨论】:
以上是关于插件 org.springframework.boot:spring-boot-maven-plugin:1.3.0.BUILD-SNAPSHOT 或其依赖项之一无法解析的主要内容,如果未能解决你的问题,请参考以下文章
无法使用 Spring Cloud 连接到 Hystrix Dashboard 的 Command Metric Stream