maven-dependency-plugin copies jars in a wrong way - java

In my local repository (.m2/repository) I have several jars which I want them to be copied (and referenced) in my project. I have the following pom.xml for the com.google.protobuf artifact:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>groupName</groupId>
<artifactId>groupName.master</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>groupName</groupId>
<artifactId>com.google.protobuf</artifactId>
<name>com.google.protobuf</name>
<version>2.5.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-installed</id>
<phase>install</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
</artifactItem>
</artifactItems>
<outputDirectory>build</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
basically I want this plugin to copy the necessary jar file to the folder called build, which is under the module folder itself. It kinda does copy a jar. However when I click and open the jar, I see no files but only manifests. So the references obviously give error. I checked my local repository and the jar is there, and it is properly formed. So the source is not the problem. Something is wrong with the copying process.
Here are the jars of the same artifact. One is taken from the local repository (above) and the other is the so called copied one to the build folder. As you can see, the copied one lacks the class files which are found under com folder.
Why does the plugin copy this improperly? Anyone had a similar experience?
UPDATE: One thing I noticed is that these two jars have different MANIFEST files inside. Could this be a case that one of the jars is somehow taken from somewhere where it is not supposed to be?

OK, figured out. The problem was I defined the artifact in a wrong way. It should have been:
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<overWrite>true</overWrite>
<type>${project.packaging}</type>
<outputDirectory>build</outputDirectory>
<destFileName>protobuf-java-2.5.0.jar</destFileName>
</artifactItem>
Notice the <name> tag, which was not correct in my pom.xml, therefore the system could not grab the necessary artifact. Also the destFileName tag.
Also, above, this was wrong:
<groupId>groupName</groupId>
<artifactId>com.google.protobuf</artifactId>
<name>com.google.protobuf</name>
If you want to use the one you download from the central repository, you cannot change the groupId or artifactId. They should stay as they are given in the website of the package.
After fixing these, now I am able to see the class files.

Add this plugin pox.xml
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-appCtx</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<!--copy location-->
<outputDirectory>src/main/resources</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<!--file location-->
<directory>${basedir}/lib</directory>
<includes>
<include>test1.jar</include>
<include>test2.jar</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

Related

Maven: Adding classes from war/web-inf/classes as a jar to war/web-inf/lib

I'm rather new to maven here. I have created a Maven Spring boot project with following structure -
..
<groupId>com.example</groupId>
<artifactId>MavenWeb</artifactId>
<version>0.0.1</version>
<packaging>war</packaging>
<name>MavenWeb</name>
<description>Maven Test Web Application</description>
<dependencies>
..
As you can see the packaging has been set as war. As such when the war file is generated, my source code's generated .class files are generated in the war/web-inf/classes folder. Rather than it being generated in classes folder, I'd like to generate it as jar file and maintain it in war/web-inf/lib folder.
I'm guessing I need to make use of the maven-jar-plugin for this.
But I'm not sure how to move the generated jar to war/web-inf/lib directory? Is there a simpler alternative to this?
Also how can I restrict the .class files from being generated in war/web-inf/classes folder?
Would really appreciate some pointers. Many thanks.
This is how the build section of pom should be -
<groupId>com.example</groupId>
<artifactId>MavenWeb</artifactId>
<version>0.0.1</version>
<packaging>war</packaging>
<name>MavenWeb</name>
<description>Maven Test Web Application</description>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archiveClasses>true</archiveClasses>
<webResources>
</webResources>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<packaging>jar</packaging>
<generatePom>true</generatePom>
<artifactId>${project.artifactId}</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
<file>
${project.build.directory}/${project.artifactId}-${project.version}.jar
</file>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
This would restrict the compiled classes from being generated in classes folder while at the same time generate a thin jar of the compiled classes and add it as web-inf/lib/MavenWeb-0.0.1.jar.

Spring Boot Layered jar: Extract layers.xml to separate dependency

I'm starting to catch up on the capabilities of the repackage goal in spring-boot-maven-plugin.It looks promising, but I need to fine-tune it a little.
I can easily do that by creating a layers.xml file somewhere in my project, but the problem is that I don't only have 1 project, but rather half a dozen. All of the projects need the same kind of layering, but I don't really want to copy the same configuration for every project I want to use it on.
A nice-looking solution would be to extract that configuration file into a separate jar for example and have the plugin take the config file from there, but I see no way of doing it. Is there any other solution that doesn't involve me copying the configuration file to every project I have?
Unfortunately, even though the projects I have use the same parent, but are not in the same multi-module project.
I managed to work out a solution.
Before asking the question my spring-boot-mave-plugin config looked something like this:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<layers>
<enabled>true</enabled>
</layers>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
<phase>package</phase>
<configuration>
<layers>
<enabled>true</enabled>
<configuration><!-- something like classpath:layers.xml --></configuration>
</layers>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>artifact</groupId>
<artifactId>with-layers.xml</artifactId>
<version>...</version>
</dependency>
</dependencies>
</plugin>
The solution becomes one step more convoluted, by bringing in the maven-dependency-plugin, which downloads the before mentioned dependency and unpacks it in the build folder with this configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy-shc-build-tools</id>
<goals>
<goal>unpack</goal>
</goals>
<phase>package</phase>
<configuration>
<artifactItems>
<artifactItem>
<groupId>artifact</groupId>
<artifactId>with-layers.xml</artifactId>
<version>...</version>
<type>jar</type>
<outputDirectory>${project.build.directory}</outputDirectory>
<includes>**/layers.xml</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
<configuration>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</plugin>
In turn, the line <configuration><!-- something like classpath:layers.xml --></configuration> becomes <configuration>${project.build.directory}/layers/layers.xml</configuration>.
The documentation for Spring Boot Maven Plugin states you can set the path to the layers.xml manually, so why not have all pom.xml point to the same location?
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.2.RELEASE</version>
<configuration>
<layers>
<enabled>true</enabled>
<configuration>${project.basedir}/../layers.xml</configuration>
</layers>
</configuration>
</plugin>
</plugins>
</build>
</project>
The /../ means one level higher from the project directory. So say you have a bunch of projects in one directory, put the layers.xml there and it'll work.
Another approach could be to reuse the Maven Plugin declaration by moving it to a so-called parent POM. This is a technique where the common/shared parts of the POM files of a series of projects is moved to a single POM file (the parent POM). Here's an example

How to download and compile SwingX

This must be mostly a newbie Maven question.
Since SwingX migrated to Kenai, there are warnings all over the website that many links are broken.. so here is my best attempt.
I went to https://java.net/projects/swingx/downloads/directory/releases
Clicked on "SwingX 1.6.4 All - Sources" (really a non-intuitive, hit-or-miss choice for me, but perhaps it's a naming convention other people understand?)
This downloads swingx-all-1.6.4-sources.jar (why is it even a jar and not a zip?)
However, this source jar does not contain POM.XML.
So, I downloaded swingx-all-1.6.4.jar from the same link, renamed it to .zip, inflated. It does contain
META-INF\maven\org.swinglabs.swingx\swingx-all\POM.XML:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>swingx-project</artifactId>
<groupId>org.swinglabs.swingx</groupId>
<version>1.6.4</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>swingx-all</artifactId>
<packaging>jar</packaging>
<name>SwingX Complete</name>
<description>A Maven project to aggregate all modules into a single artifact.</description>
<properties>
<project.generatedDependencies>${project.generatedSourcesDirectoy}/dependencies</project.generatedDependencies>
</properties>
<!-- make the dependent swingx modules optional, since we're aggregating -->
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>swingx-graphics</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>swingx-core</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>swingx-mavensupport</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
<profiles>
<profile>
<id>jvnet-release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>src-dependencies</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<includeGroupIds>${project.groupId}</includeGroupIds>
<excludeArtifactIds>swingx-mavensupport</excludeArtifactIds>
<failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
<outputDirectory>${project.generatedDependencies}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>add-dependencies-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.generatedDependencies}</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-dependencies-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${project.generatedDependencies}</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.generatedAnnotations}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
When I change to the above directory where POM.XML is located and do mvn install, it certainly builds a lot of stuff.. but also says:
[INFO] skip non existing resourceDirectory
F:\swingx\swingx-all-1.6.4\META-INF\m
Maven\org.swinglabs.swingx\swingx-all\src\main\resources
That's because the src directory is nonexistent. Which makes sense, because the .jar files in question is said to be binaries only, but I was hoping some Maven target would download sources or something... and if it's binary only, why does it need to be built? Confused.
At that point, I could probably either copy the src directory from the first zip file to the second, or copy the pom.xml from the second file to the first.. but I am having a feeling I am missing something, and there has to be a more straightforward way.
BTW, there is a third file at the same web page, swingx-mavensupport-1.6.4.jar
So I downloaded that, renamed it to .zip, inflated, found this file:
META-INF\maven\org.swinglabs.swingx\swingx-mavensupport\POM.XML:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>swingx-project</artifactId>
<groupId>org.swinglabs.swingx</groupId>
<version>1.6.4</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>swingx-mavensupport</artifactId>
<name>SwingX Maven Support</name>
</project>
Changed to its directory and ran mvn.install
However, that complained at the lack of a whole lot of files.
I must be getting it all wrong. What's the right way?
Use the following URL for SVN checkout: https://svn.java.net/svn/swingx~svn.
In trunk there is a correct pom.xml file (actualy many of them for different artifacts), so you can easily build the project yourself.
swingx-all-1.6.4-sources.jar (why is it even a jar and not a zip?)
That's the default way sources are packaged and distributed in Maven.

maven build with war and jar pushing odd artifacts to internal repo

I have a maven project where I am building a war file, but I am also using the maven-jar-plugin to build a jar in the same project.
--DISCLAIMER--
I know this is not the 'correct' way to do this, but there are some other issues occurring when splitting this into a jar project and a separate war project with some 3rd party plugins.
I am seeing some strange behavior with this. Below is my project structure.
warproject
-src
--main
---webapp
----WEB-INF
-----web.xml
---java
----com.test.myclass
-----test.java
-pom.xml
When I build this project, i get the correct war and jar file in my target directory, however in my local .m2 repo something strange happens. The war file that is installed is named correctly war-jar-0.0.1-SNAPSHOT.war, however the contents of this file are the contents of my jar file. This also occurs if I do the inverse. i.e. if I setup my project to build a jar and use the maven-war-plugin to build the war, the archives in my target directory are correct, but my local repo has jar file with the contents of my war file. Below is the pom file I am using.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>war-jar</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<jarName>${project.artifactId}-${project.version}-client</jarName>
</configuration>
<executions>
<execution>
<id>make-a-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</project>
The console output for this is the following, it shows that the jar is being uploaded as the war.
Installing /home/me/work/src/war-jar/target/war-jar-0.0.1-SNAPSHOT.jar to /home/me/.m2/repository/com/test/war-jar/0.0.1-SNAPSHOT/war-jar-0.0.1-SNAPSHOT.war
--UPDATE
I got this working, but I had to change the phase of my 'make-a-jar' execution to install from package. This works fine and the correct artifacts are uploaded, but I am still confused as to why this makes a difference. Obviously the artifact is generated at a different lifecycle phase, and hence is not around at the time of the original install for the project, hence the wrong file is not uploaded. This seems like a 'hack' and I would like to understand why this is behaving this way.
I'm answering my own questions since I didn't get any information that helped me get to my solution. See my update on my original question for my solution.
This also works,
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<!--
When also running maven-jar-plugin correct maven-war-plugin's ID
from "default-war" to "default-jar"
-->
<id>default-jar</id>
<phase>package</phase>
<goals><goal>war</goal></goals>
<configuration>
...
</configuration>
</execution>
</executions>
</plugin>
Refer to http://maven.apache.org/guides/mini/guide-default-execution-ids.html
To figure out why your project behaves as is, analyze the Effective POM.
You need to specify the configurations for the maven-install-plugin to achieve this. Add the following plugin config under <build>.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<packaging>jar</packaging>
<artifactId>${project.artifactId}</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
<file>
${project.build.directory}/${project.artifactId}-${project.version}.jar
</file>
</configuration>
</execution>
</executions>
</plugin>

Maven add jars through systemPath/system but not added to war or anywhere else

I want to add a jar file through the systemPath from the local file-system relative to my project directory structure, not on a remote repository. I added the dependency declaration but maven doesn't do anything else with it.
In the declaration below, I want the jar file copied to my target web-inf/lib directory and also jarred as part of the war file. At present, that doesn't happen. How would I get the jar file copied to my war file?
This is the output from debug maven mode:
DEBUG] cglib:cglib-nodep:jar:2.2:test (setting scope to: compile)^M
DEBUG] Retrieving parent-POM: org.objenesis:objenesis-parent:pom:1.2 for project: null:objenesis:ja
DEBUG] org.objenesis:objenesis:jar:1.2:test (selected for test)^M
DEBUG] org.javap.web:testRunWrapper:jar:1.0.0:system (selected for system)^M
DEBUG] Plugin dependencies for:
...
<dependency>
<groupId>org.javap.web</groupId>
<artifactId>testRunWrapper</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/testRunWrapper.jar</systemPath>
</dependency>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>WebContent</directory>
</resource>
</webResources>
</configuration>
</plugin>
OK, I did this: Note the directory structure at the bottom.
With the approach below, the jar file from the relative project path is treated as a first class citizen like the other jars. The listing below corrects my original problem. With the pom.xml listing below, the jar file is copied to my target directory.
<repositories>
<repository>
<id>JBoss</id>
<name>JBoss Repository</name>
<layout>default</layout>
<url>http://repository.jboss.org/maven2</url>
</repository>
<repository>
<id>my-local-repo</id>
<url>file://${basedir}/lib/repo</url>
</repository>
</repositories>
<dependency>
<groupId>testRunWrapper</groupId>
<artifactId>testRunWrapper</artifactId>
<version>1.0.0</version>
</dependency>
$ find repo
repo
repo/testRunWrapper
repo/testRunWrapper/testRunWrapper
repo/testRunWrapper/testRunWrapper/1.0.0
repo/testRunWrapper/testRunWrapper/1.0.0/testRunWrapper-1.0.0.jar
Using the maven dependency plugin does the job:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/lib</outputDirectory>
<includeScope>system</includeScope>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Don't use system. To do what you want, just declare as a regular (compile) dependency and use mvn install:install-file into your local repository. Everything else will work as you want (lib will be copied, etc.) That will mean that the build will only work on your machine, however.
To properly fix this for your (internal) team, you will want to set up a repository (e.g. Artifactory, Nexus, or Archiva). This is almost a must for team use of Maven.
If this is for public (e.g. open source) use you can either mimic a repository via an http server or put up a real repository.
try something like this (using Ant plugin to manually put the jar to output directory):
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy file="${project.basedir}/pathToJAR.jar"
todir="${project.build.directory}/outputFileName/WEB-INF/lib"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
AFAIK, system scoped dependencies are somewhat like those with provided scope and thus are not included in the target artifact. Why don't you install the dependency into your local repository instead?
From the doc:
system
This scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository.
In case this answer didn't work for you as it didn't for me and you know that system is a bad scope, you can try this solution where you are Installing the jar by using install-plugin (scroll down a bit), which installs the JAR into your actual local Maven-repository. Basically you only need to add this plugin to your pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>myGroupId</groupId>
<artifactId>myArtifactId</artifactId>
<version>myVersion</version>
<packaging>jar</packaging>
<file>${basedir}/lib/xxx.jar</file>
</configuration>
</execution>
</executions>
</plugin>
Fill in the appropriate values for groupId, artifactId and version and put your original jar file into the <project-home>/lib-directory and fix file above. You can add more execution-sections, but then don't forget to add ids there, like:
<execution>
<id>common-lib</id>
Everybody who updates from the code-repo needs to call mvn initialize once.
And all Eclipse-enthusiasts may add this to pom.xml, too, to get rid of errors in Eclipse:
<pluginManagement>
<plugins>
<!-- This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<versionRange>[2.4,)</versionRange>
<goals>
<goal>install-file</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute></execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
The problem with using a reference to the file system is that dependent projects will not be able to globally access this jar file. i.e. the dependent project's ${basedir} is different and thus the .jar file won't be found.
Global repositories on the other hand are universally accessible.

Categories