You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by g0h4n <ca...@gmail.com> on 2010/01/25 11:56:39 UTC

Especify different dependencies for different JARs on the same project

Hi,

I would like to create more than one jar file from one maven project. The
reason is that i have a project in about 4 subprojects. Then, i create
another subproject for subprojects common classes. I used the jar plugin to
create a jar per subproject, but it includes the pom.xml with all
dependencies, so its not what i want. I dont know how i could establish the
dependencies of each jar, with a pom.xml for each subproject jar, with the
dependency plugin or somehow. I'll apreciate any help.

Thanks

I leave my pom if it helps

<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">
    <parent>
        <artifactId>${parent-project}</artifactId>
        <groupId>${groupId}</groupId>
        <version>${parent-version}</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>${groupId}</groupId>
    <artifactId>${common-classes}</artifactId>
    <packaging>jar</packaging>
    <version>${common-classes-version}</version>
    <name>${common-classes}</name>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <id>subproject1</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                           
<classifier>${subproject1-classifier}</classifier>
                            <includes>
                                <include>**/utils/*</include>
                                <include>**/commons/**</include>
                                <include>**/signature/*</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>subproject2</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                           
<classifier>${subproject2-classifier}</classifier>
                            <includes>
                                <include>**/utils/*</include>
                                <include>**/commons/**</include>
                                <include>**/certificates/*</include>
                                <include>certificates.properties</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>webapp</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                       
                            <classifier>${webapp-classifier}</classifier>
                            <includes>
                                <include>**/utils/filters/*</include>
                                <include>**/service/*</include>
                                <include>**/ws/**</include>
                                <include>**/xmlschema/*</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <executions>
                    <execution>
                        <id>subproject1</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                           
<file>${project.build.directory}/${project.build.finalName}-${subproject1-classifier}.${project.packaging}</file>
                            <groupId>${groupId}</groupId>
                            <artifactId>${subproject2-commons}</artifactId>
                           
<version>${subproject2-commons-version}</version>
                            <packaging>jar</packaging>
                        </configuration>
                    </execution>
                    <execution>
                        <id>subproject2</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                           
<file>${project.build.directory}/${project.build.finalName}-${subproject2-classifier}.${project.packaging}</file>
                            <groupId>${groupId}</groupId>
                            <artifactId>${subproject2-commons}</artifactId>
                           
<version>${subproject2-commons-version}</version>
                            <packaging>jar</packaging>
                        </configuration>
                    </execution>
                    <execution>
                        <id>webapp</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                           
<file>${project.build.directory}/${project.build.finalName}-${webapp-classifier}.${project.packaging}</file>
                            <groupId>${groupId}</groupId>
                            <artifactId>${webapp-commons}</artifactId>
                            <version>${webapp-commons-version}</version>
                            <packaging>jar</packaging>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>

    </build>
    <repositories>
        <repository>
            <releases />
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>maven</id>
            <url>http://repo2.maven.org/maven2</url>
        </repository>
        <repository>
            <releases />
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>apache</id>
            <name>Apache Repository</name>
           
<url>http://people.apache.org/repo/m2-ibiblio-rsync-repository</url>
        </repository>
        <repository>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots />
            <id>apache.snapshots</id>
            <name>Apache Snapshots Repository</name>
            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
        </repository>
        <repository>
            <id>servicemix-repo</id>
            <name>ServiceMix Repository</name>
            <url>http://svn.apache.org/repos/asf/servicemix/m2-repo/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <releases />
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>repository.jboss.org</id>
            <name>JBOSS Repository</name>
            <url>http://repository.jboss.org/maven2/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <releases />
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>apache</id>
            <name>Apache Repository</name>
           
<url>http://people.apache.org/repo/m2-ibiblio-rsync-repository</url>
        </pluginRepository>
        <pluginRepository>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots />
            <id>apache.snapshots</id>
            <name>Apache Snapshots Repository</name>
            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
        </pluginRepository>
    </pluginRepositories>
    <dependencies>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf-version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf-version}</version>
        </dependency>
        <dependency>
            <groupId>bouncycastle</groupId>
            <artifactId>bcprov-jdk15</artifactId>
            <version>144</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>${commons-logging-version}</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.opensaml</groupId>
            <artifactId>opensaml</artifactId>
            <version>1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.santuario</groupId>
            <artifactId>xmlsec</artifactId>
            <version>1.4.2</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
            <version>2.7.1</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.0</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>
 
    </dependencies>
    <properties>
        <webapp-classifier>webapp</webapp-classifier>
        <subproject1-classifier>subproject1</jboss-service-classifier>
        <subproject2-classifier>subproject2</bean-service-classifier>
    </properties>
</project> 
-- 
View this message in context: http://old.nabble.com/Especify-different-dependencies-for-different-JARs-on-the-same-project-tp27304961p27304961.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org