0

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

user3870315
  • 1,171
  • 3
  • 15
  • 37
  • Did you try to enable debug logging for more details? That's "mvn -X" from the command line. If you're executing Maven from within some IDE, you might mention about that, also. Many of the Maven plugins for IDEs do not faithfully reproduce the behavior you would see at the command line. – unigeek Feb 25 '15 at 22:51
  • Thanks for the helpful feedback. I am actually not using an IDE and am running this from the command line. :D – user3870315 Feb 25 '15 at 22:54
  • You might also consult this helpful SO question.. http://stackoverflow.com/questions/2229757/maven-add-a-dependency-to-a-jar-by-relative-path – unigeek Feb 25 '15 at 22:58

1 Answers1

0

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>
Harald Wellmann
  • 11,788
  • 2
  • 36
  • 56
  • This takes care of the WARNING message but I do not see that the `myApp` pom.xml file is actually downloading the dependency during the Maven `mvn clean package -U` command. In the tutorial the output from Maven shows that the dependency is downloaded. Here are a few lines copied from the tutorial: `[INFO] Building consumerBanking` `[INFO] task-segment: [clean, package]` `[INFO] -------------------------------------------------------------------` `[INFO] Downloading data-service:1.0-SNAPSHOT` `[INFO] 290K downloaded.` – user3870315 Feb 25 '15 at 22:52