I am trying to add maven release plugin to pom.xml file but it returns
Plugin 'org.apache.maven.plugins:maven-release-plugin:' not found
CodePudding user response:
What you're seeing is your IDE complaining that it doesn't know (yet) about this new plugin you've added. It looks like Intellij IDEA from Jetbrains, so my first advice would be to:
- run a maven goal that includes this plugin; for example
mvn release:help
. This will make sure the plugin gets resolved and downloaded (it is in central so should give no problems) - you should also see the
release
plugin be listed in themaven
tab in IDEA now underplugins
- tell IDEA to update it's own state from maven. IDEA has a hard time detecting new plugins, as they're not part of the normal project build dependencies. See Force Intellij IDEA to reread all maven dependencies
- If the maven goal runs fine, the plugin is working. Try refreshing in IDEA or closing reopening the project a few times until IDEA gets it.
Regarding the "missing" version
tag. If you're not specifing an exact version of the plugin to use, you're currently getting this plugin (version) from the maven super pom:
- https://maven.apache.org/ref/3.8.5/maven-model-builder/super-pom.html
- you can run the following maven command to view your combined effective pom; super pom, your own pom default bindings:
mvn help:effective-pom
- your current configuration should be sufficient, but if you want more control you can specify a
version
explicitly. See the following link for available version: https://search.maven.org/artifact/org.apache.maven.plugins/maven-release-plugin - if you really want this "error" from IDEA to go away, you must specify the version. It seems IDEA doesn't understand that the version is inherited from the super pom. You can tell because the error message
org.apache.maven.plugins:maven-release-plugin:
is in the format ofgroupid:artifactid:version
, andversion
is missing. Adding a version would look like something like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
(this is the default for maven 3.8.5, you can pick a newer version if you want)