I have an artifact which is being built and deployed in a particular way (not as a jar file). In the course of deployment, a war file is built.
How can I configure the pom so that the artifact is also deployed as a jar file, to a different location?
If the jars are available in Maven Central repo then all you hvae to do is add dependency under dependencies section in your pom. xml file. Set the scope as required, like you said jars don't needed to be packaged in WAR file as they might be available on server then you can set scope to provided.
Maven install plugin has command line usage to install a jar into the local repository, POM is optional but you will have to specify the GroupId, ArtifactId, Version and Packaging (all the POM stuff). -1, sometimes you just want to add a jar file without the trouble of installing it.
Nexus has very low resource requirements, and it is something you can run on an existing workgroup collaboration machine or locally. When you upload a 3rd-party JAR to your own Nexus instance, it will immediately be integrated with Nexus search capabilities and be available to your organization's builds.
Maven deploy
means deploy artifact to a Maven Repository, not an application server.
Configure additional JAR artifact like this:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <id>make-a-jar</id> <phase>compile</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin>
Attach this new artifact to your project:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.7</version> <executions> <execution> <id>attach-artifacts</id> <phase>package</phase> <goals> <goal>attach-artifact</goal> </goals> <configuration> <artifacts> <artifact> <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file> <!-- <file>${project.build.directory}/${project.build.finalName}.jar</file> - if finalName is defined --> <type>jar</type> </artifact> </artifacts> </configuration> </execution> </executions> </plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With