I already create a jar that contain some common jars, which we will use it in different applications and can be used via many users.
To Solve this, i create a common jars, so i can control this commons jars and version of them, then store it in nexus server, so it can contain the parent pom and can be used by many developers.
So i create a simple maven java application and in the pom of this jar, i put for example :
Parent pom
<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.emp</groupId>
<artifactId>dependencymanager</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
Then in the child applications i use this jar like this:
<dependencies>
<dependency>
<groupId>com.emp</groupId>
<artifactId>dependencymanager</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
But when i try to use org.primefaces
, i can't. Where i'm wrong, or i'm wrong in the implementation of dependency management?
Note
I already read this : http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
So in the example of this tutorial it not specify the version of the parent pom, so when i delete it show me an error like this :
'dependencies.dependency.version' for com.emp:dependencymanager:jar is missing.
Question
- How can i implement dependency management in this case?
- Is there any better way then this to work with same dependencies with many projects and many devellopers.
- I use nexus to store my jars
Thank you.