Maven jarsigner plugin does not work during release
jarsigner, java, maven, maven-3, maven-release-plugin
Solution
Found the answer.
In short `-D` arguments are not passed from the command line to the release plugin. `-Darguments=` should be used.
For more details please read this blog post that helped me to resolve this issue.
Problem
I need to sign the released jars and I want to do it with the maven jarsigner plugin. So I added it like this: ``` <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jarsigner-plugin</artifactId> <version>1.2</version> <configuration> <archive>target/${myarchive}.jar</archive> <keystore>${key.location}</keystore> <storepass>${keypass}</storepass> <alias>${key.alias}</alias> <verbose>true</verbose> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>sign</goal> </goals> </execution> </executions> </plugin> ``` I provide the missing parameters in command line. When I run `mvn install` everything works fine and the archive is got signed. But when I run `release:prepare release:perform` the jarsigner plugin fails: `The parameters 'alias' for goal org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign are missing or invalid' When I run in debug mode, I see the following: For `mvn install`: ``` [DEBUG] Configuring mojo org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign from plugin realm ClassRealm[plugin>org.apache.m aven.plugins:maven-jarsigner-plugin:1.2, parent: sun.misc.Launcher$AppClassLoader@6d6f0472] [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign' with basic configurator --> [DEBUG] (f) alias = myalias [DEBUG] (f) archive = myarchive [DEBUG] (f) arguments = [] [DEBUG] (f) keystore = mykeystore [DEBUG] (f) processAttachedArtifacts = true [DEBUG] (f) processMainArtifact = true [DEBUG] (f) project = MavenProject: com.playtech.chat:ums_supportchatapplet:12.4-SNAPSHOT @ *********\pom.xml [DEBUG] (f) removeExistingSignatures = false [DEBUG] (f) skip = false [DEBUG] (f) storepass = changeit [DEBUG] (f) verbose = true [DEBUG] -- end configuration -- ``` But when I run `release:prepare release:perform`, I see: ``` Configuring mojo org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-jarsigner-plugin:1.2, parent: sun.misc.Launcher$AppClassLoader@553f5d07] [INFO] [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-jarsigner-plugin:1.2:sign' with basic configurator --> [INFO] [DEBUG] (f) archive = myarchive [INFO] [DEBUG] (f) arguments = [] [INFO] [DEBUG] (f) processAttachedArtifacts = true [INFO] [DEBUG] (f) processMainArtifact = true [INFO] [DEBUG] (f) project = MavenProject: com.playtech.chat:ums_supportchatapplet:12.4.0.1 @ *****\pom.xml [INFO] [DEBUG] (f) removeExistingSignatures = false [INFO] [DEBUG] (f) skip = false [INFO] [DEBUG] (f) verbose = true [INFO] [DEBUG] -- end configuration -- ``` So except of `archive` property, other properties are ignored during the release. Any ideas are highly appreciated.