Output in our example will be named as core-java-jar-with-dependencies.jar. In the descriptorRefs part of the configuration code, we provided the name that will be added to the project name. The previous sectionĪbout installing the jar in a local repository is also a prerequisite. The difference is that the Maven Assembly Plugin will automatically copy all required dependencies into a jar file.
It is quite an hack, all the more since you will have to do the same pluginīlock to take into account other potential jar files. maven-install-plugin copy-jar validate install-file lib-maven/net/alea/test/sample-lib/1.0/sample-lib.jar default sample-lib 1.0 jar You can add the following in your pom.xml if you want Maven cache to at ~/.m2/repository/net/alea/test in our case). By default, you have to manually delete in the Maven cache your DartifactId : The name of the JAR, appended to the end of the DgroupId.
#MAVEN INSTALL JAR UPDATE#
While the local repository mechanism work, the problem is Maven does notĪutomatically take into account the jar if you update it using the same Publish Maven artifacts in your projects Package Registry. There is not sense in distributing a library that depends on local resources. Add local jar libraries, their sources and javadoc to a Maven project Create a local Maven repository directory, Your project root should look something like.
Libraries since the local repository configuration will stay in the pom file. It should also be used for end-project, and not for distribuable jar Install the JAR into your local Maven repository (typically. The same jar and someone already build your project, the new jar will not be Otherwise Maven will not recognize that it was updated. You must also change the version of the jar library in case of an update, The only thing is to correctly use the maven commands, even to update the jar. The local repository and then transparently copied in the Maven cache. When someone launches a mvn command, dependencies will also be looked into sample-lib 1.0 system $/lib-maven/ sample-lib 1.0 You need to add maven war plugin into pom.xml file to create an war file for the web application.