简体   繁体   中英

Maven Snapshots Is Not Working I Do Not Think

I am trying to follow this tutorial: http://www.tutorialspoint.com/maven/maven_snapshots.htm

I think I am running into problems with this though. When I run the pom.xml for the project in the myApp directory I receive the following output:

[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] ------------------------------------------------------------------------

The WARNING message directly below [INFO] Building myApp 1 is what I think means that the myApp pom.xml is not successfully grabbing the latest SNAPSHOT for the other module it calls in its pom.xml.

The SNAPSHOT functionality should allow for another module to grab the latest version of the build for a different module that the first module depends on.

Below is my pom.xml for the first project, myApp , that depends on the latest version of another project.

<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>

Now, below one will find the pom.xml for the consumerBanking project that the previous pom.xml for myApp depends on.

<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.companyname.bank</groupId>
  <artifactId>consumerBanking</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>consumerBanking</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <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>


  </dependencies>
</project>

Does anyone know why I am receiving the WARNING? Does this mean the SNAPSHOT functionality is not working correctly? The message I am referring to is:

"The POM com.companyname.bank:consumerBanking:jar:1.0-SNAPSHOT is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details"

Thank-you for reading all of this!

Regards,

me

I suppose Maven regards your dependency POM as invalid due to this section which does not make sense:

<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM