我正在尝试按照本教程:http://www.tutorialspoint.com/maven/maven_snapshots.htm
我认为我遇到了这个问题。当我在pom.xml
目录中运行项目的myApp
时,我收到以下输出:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myApp 1
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.companyname.bank:consumerBanking:jar:1.0-SNAPSHOT is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ myApp ---
[INFO] Deleting C:\Users\name\Desktop\MavenFoo1\myApp\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ myApp ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\name\Desktop\MavenFoo1\myApp\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ myApp ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Users\name\Desktop\MavenFoo1\myApp\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ myApp ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\name\Desktop\MavenFoo1\myApp\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ myApp ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Users\name\Desktop\MavenFoo1\myApp\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ myApp ---
[INFO] Surefire report directory: C:\Users\name\Desktop\MavenFoo1\myApp\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.companyname.appid.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ myApp ---
[INFO] Building jar: C:\Users\name\Desktop\MavenFoo1\myApp\target\myApp-1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.141 s
[INFO] Finished at: 2015-02-25T15:29:16-06:00
[INFO] Final Memory: 10M/26M
[INFO] ------------------------------------------------------------------------
[INFO] Building myApp 1
正下方的警告消息是我认为myApp
pom.xml没有成功获取它在pom.xml中调用的其他模块的最新SNAPSHOT。
SNAPSHOT功能应该允许另一个模块为第一个模块所依赖的不同模块获取最新版本的构建。
以下是第一个项目pom.xml
的{{1}},取决于另一个项目的最新版本。
myApp
现在,下面的一个会找到<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.companyname.appid</groupId>
<artifactId>myApp</artifactId>
<packaging>jar</packaging>
<version>1</version>
<name>myApp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.companyname.bank</groupId>
<artifactId>consumerBanking</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
项目的pom.xml
,前一个consumerBanking
的pom.xml依赖于它。
myApp
有谁知道我收到警告的原因? 这是否意味着SNAPSHOT功能无法正常工作?我所指的信息是:
&#34; POM com.companyname.bank:consumerBanking:jar:1.0-SNAPSHOT是 无效,传递依赖(如果有)将无法使用, 启用调试日志记录以获取更多详细信息&#34;
感谢您阅读所有这些内容!
此致
我
答案 0 :(得分:0)
我认为Maven认为你的依赖POM是无效的,因为这部分没有意义:
<dependency>
<groupId>c3p0-0.9.1.1</groupId>
<artifactId>c3p0-0.9.1.1</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\lib\c3p0-0.9.1.1.jar</systemPath>
</dependency>