The jar-with-dependencies assembly mechanism uses the maven dependencies you've declared, and not from what's in your resources directory. If you want to use a newer version of a jar, declare a newer version as the dependency in your .pom file.
how to avoid resource override when using maven to generate runnable jar?
Question
I have one maven project and depend one jar which contain one resource file(c3p0.xml), I copy the resource into my src/main/resource folder and change the content according to my requirements so that I can use it.
but after I run the mvn assembly:assembly command, the generated jar contained resource's content is old in dependence jar not my content in src/main/resource How to handle it?
My pom.xml's key content is as followed:
<plugin>
<!-- mvn assembly:assembly -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.fastcheck.RequestUrl</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
No correct solution
OTHER TIPS
You should bind maven-assembly-plugin to the build life cycle like this:
<project>
[...]
<build>
[...]
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
[...]
</project>
which will be execute the maven-assembly-plugin within the package life cylce phase.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow