Multiple maven pom.xml files
I have an Eclipse project with a GWT client and a Restlet API. I normally use Maven for dependency management but I hav开发者_开发技巧ent used it in an Eclipse project where seperate parts have seperate dependencies. For example - the client would use Google Gin for dependency injection and the server uses Google Guice.
Am I able to split it into two seperate pom.xml files to manage the dependencies of both seperate areas?
Thanks
You can create a multi module project. See examples here and here and here.
You could create a new pom like this:
<?xml version="1.0" encoding="UTF-8"?>
<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.mycompany</groupId>
<artifactId>your-dependencies</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<dependencies>
...
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>mailapi</artifactId>
<version>1.5.0</version>
</dependency>
...
</dependencies>
</project>
Then in your original project just add:
<dependencies>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>your-dependencies</artifactId>
<version>1.0.0</version>
<type>pom</type>
</dependency>
</dependencies>
精彩评论