If you don’t have Maven repository server like Archiva or Nexus, you may need to include those libs which are not public on the internet in your Maven project and specifiy the dependency scope as system in the pom.xml. The following example includes the eureka-0.0.1.jar which is located in the folder called external on project root.
If you want to use the <sshexec> or <scp> tasks in the maven-antrun-plugin, you may find the following error.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (default-cli) on project fraudcheck: An Ant BuildException has occured…
Long time ago, i had a post about running Ant in Maven using the maven-antrun-plugin but the Ant script would be attached to the Maven lifecycle phase.
Sometimes you may just want to run a standalone Ant task in Maven without being involved in any lifecycle phase. In that case, you can try configure the maven-antrun-plugin as follow.
An alternative solution is to put your dependencies in the src/main/resources folder and they will be copied to the target folder together with the packaged .jar file. Then we can add the class paths to these dependencies in the Manifest with the help of the maven-jar-plugin.
Sometimes we want to build a executable jar which contains all the dependencies. In this case we could make use of the maven-assembly-plugin which help us to package a jar-with-dependencies artifact during the Maven package phase. Let’s refer to the simple Maven project we did before.
1. First let’s introduce a dependency to our project. Say, we want to make use of the Apache Commons – Commons Lang to check the empty string. Edit the src/main/java/info/ykyuen/eureka/Addition.java as follow. Continue reading Maven – Package the jar file with dependencies→
We can set the default main class in the META-INF/MANIFEST.MF. This could be configured in the maven-jar-plugin in pom.xml. Let’s use the previous example.
Like Maven, we could setup a repository server for better dependency management. So instead of connecting to the public repository, we want our Apache Ivy project links to our repository server, i have already setup the Artifactory repository server in my local machine. Let’s continue with the project we created yesterday.