Is it possible for maven to use the netsed jar

5 views
Skip to first unread message

Arpan Mukhopadhyay

unread,
Jun 28, 2016, 4:55:37 AM6/28/16
to Maven and Scala
Hi all,

I am new to maven. I have two projects (maven) - 

1. proj-core
2. proj-web

Where proj-core has all the common dependencies and project-web has the web related dependencies. In the project proj-core I have used the maven-jar-plugin as below

<modelVersion>4.0.0</modelVersion>
<groupId>org.poc</groupId>
<artifactId>proj-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Project-Core</name>
<dependencies>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

and below is my manifest entry in the MANIFEST.MF file

Manifest-Version: 1.0
Built-By: arixion
Class-Path: lib/joda-time/joda-time/2.9.4/joda-time-2.9.4.jar
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_92
After building the proj-core I am putting the jar in some different folder. In pom.xml of the proj-web I am pointing the proj-core from system scope. Now in the proj-web when I am trying to use the joda-time, maven is failing to resolve the dependency. Below is the pom.xml for proj-web

<modelVersion>4.0.0</modelVersion>
<groupId>org.poc</groupId>
<artifactId>proj-web</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Project-Web</name>

<dependencies>
<dependency>
<groupId>org.poc</groupId>
<artifactId>proj-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>C:\\path\\to\\jar\\folder\\proj-core-1.0.0-SNAPSHOT.jar</systemPath>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.poc</groupId>
<artifactId>proj-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>C:\\path\\to\\jar\\folder\\proj-core-1.0.0-SNAPSHOT.jar</systemPath>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

</project>

Could anyone tell me what I am doing wrong ?

Attaching the projects in the proj-all.zip file

Thanks
Arpan

Arpan Mukhopadhyay

unread,
Jun 28, 2016, 5:46:23 AM6/28/16
to Maven and Scala

David Bernard

unread,
Jun 28, 2016, 6:17:57 AM6/28/16
to Maven and Scala
I guess you use the wrong mailing list. This ml is about using Maven **with Scala**.

Else with maven you should avoid manipulating jar as you did, or placing local file path. So start

* by reading the doc about maven (at least about dependency management) eg: http://books.sonatype.com/mvnex-book/reference/index.html
* by removing your <systemPath> ans <scope>system</scope>
* by learning with a simple project instead of a multi-modules project


--

---
You received this message because you are subscribed to the Google Groups "Maven and Scala" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maven-and-sca...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arpan Mukhopadhyay

unread,
Jun 29, 2016, 1:42:06 AM6/29/16
to maven-a...@googlegroups.com
Thanks for the reply and  I am sorry to post it in the wrong place. I will look into the references you have given :)
 

You received this message because you are subscribed to a topic in the Google Groups "Maven and Scala" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/maven-and-scala/fMDzDeiW51Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to maven-and-sca...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages