Reputation: 405
I haven't been able to find an answer specifically regarding this problem.
I've successfully installed a patched maven plugin jar file manually (osxappbundle) using the following:
mvn install:install-file -Dfile=osxappbundle-maven-plugin-1.0-alpha-4-SNAPSHOT.jar -Dpackaging=jar -DgroupId=org.codehaus.mojo -DartifactId=osxappbundle-maven-plugin -Dversion=1.0-alpha-4-SNAPSHOT -DgeneratePom=true
When the plugin is referred to in the pom, specifically 'bundle', I receive the error:
Unable to load the mojo 'bundle' in the plugin 'org.codehaus.mojo:osxappbundle-maven-plugin:1.0-alpha-4-SNAPSHOT'. A required call is missing: org/apache/velocity/exception/MethodInvocationException.
org.apache.velocity is definitely installed and is in my local respository (.m2) but isn't found. If I manually add the class files into the jar they are found, so this suggests it's not resolving dependencies using the local repository.
I assume this is happening because I manually installed the jar file.
If a jar is manually installed, will it only resolve the dependencies if they are in the jar and not look outside?
The plugin is referenced in the pom like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>osxappbundle-maven-plugin</artifactId>
<version>1.0-alpha-4-SNAPSHOT</version>
<configuration>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
Upvotes: 2
Views: 3781
Reputation: 3442
Plugins are handled the same way as project dependencies. Whatever dependencies the original plugin refer to in its pom.xml
are put on the classpath at runtime.
It is usually sufficient to change the <version>
tag in the pom.xml
of the plugin and run mvn install
. This will install the jar and pom file to your local repository. Use a version which makes clear that it is not an official one, e.g. 1.2.3-CUSTOM-SNAPSHOT
. Then change the dependency to this version in your application's pom file and it should work as expected.
If you must use invoke install plugin directly for any reasons, you should always install a proper pom.xml
with your jar file. Use -DpomFile=/path/to/pom.xml
to specify the path to the correct pom of your plugin.
-DgeneratePom=true
will generate only a minimalistic pom if there isn't already a pom.xml
for this artifact and version in the repository. This pom file won't specify any dependencies. So never use this option if your jar/plugin has any dependencies.
References:
Upvotes: 4