less than 1 minute read

Maven dependency management Scenario: jar file from repository not in the format you want.
<dependency>
<groupid>com.mycompany.feature</groupid>
<artifactid>entity</artifactid>
<version>${mycompany-feature-entity-version}</version>
</dependency>

jar file from repository is entity-0.1.0-20130924.075312-18.jar What is needed is entity.jar because jar is referred in persistence.xml Solution: Use maven dependency plugin to configure
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>mycopy</id>
<phase>prepare-package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.mycompany.feature</groupId>
<artifactId>entity</artifactId>
<version>${mycompany-feature-entity-version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/${project.artifactId}/WEB-INF/lib</outputDirectory>
<destFileName>entity.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>

Tags:

Updated:

Comments