I have a custom plugin that compresses files that I need to include in my maven build. So I have included this plugin in my pom.xml
:
<build>
// Other tags
<plugin>
<groupId>someGroupId</groupId>
<artifactId>somePlugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Since it is a custom plugin, it is not available in any public Maven repository. So whenever I try to build, I get an error message saying:
Failed to read artifact .....
even though I have added it to my local repository. How can I refer to this plugin that is in my local repository?
Introduction. In Maven, there are two kinds of plugins, build and reporting: Build plugins are executed during the build and configured in the <build/> element. Reporting plugins are executed during the site generation and configured in the <reporting/> element.
We can use -U/--update-snapshots flag when building a maven project to force maven to download dependencies from the remote repository. Here, -U,--update-snapshots : Forces a check for missing releases and updated snapshots on remote repositories.
If you mean local repository in the classic sense, make sure that you installed your plugin jar correctly. Install it to your local repository again with the following command:
mvn install:install-file -Dfile=/some/path/somePlugin.jar -DgroupId=someGroupId -DartifactId=somePlugin -Dversion=1.0.0 -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
You should then be able to use your plugin in your Maven build.
If you mean local in the sense of some locally hosted repository, you need to specify the repository containing your artifact as a pluginRepository
. Add the following to the top level of your pom.xml
:
<pluginRepositories>
<pluginRepository>
<id>some-repo</id>
<name>Some Repository</name>
<url>http://some.host/some/path</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
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