Thursday, September 8, 2011

classifier in maven dependency

Maven build can create multiple jar files and all of them could be installed in maven repository.

For example, when you build a ejb jar file, you may also want to build the ejb-client.jar file.

<plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-ejb-plugin</artifactId>

                <version>2.3</version>

                <configuration>

                    <ejbVersion>3.0</ejbVersion>

                    <generateClient>true</generateClient>

                </configuration>

            </plugin>


The setting above would generate the ejb client jar file. It would be installed in maven repository if you run “mvn install”.



image



For the project depends on the ejb client jar file, put this in pom.xml.



<dependency>

            <groupId>my.transaction</groupId>

            <artifactId>txejb</artifactId>

            <version>1.0</version>

            <classifier>client</classifier>

        </dependency>


It load txejb-1.0-client in classpath.

No comments:

Post a Comment