How to sign a jar with maven, but changing jdk?
题
In my scenario I have one jar file compiled with JDK6 through maven. This jar needs to be signed. So, I used the maven-jarsigner-plugin for doing this job, and it works fine!
However, my mission is to sign this jar pointing to JDK1.5. But the jar needs to be built using JDK6. So, my question is: can I build the jar using JDK6, but changing to JDK5 specificaly for signing it? Is it possible?
Thanks a lot!
Rodrigo
解决方案
The jarsigner options mention the -Jjavaoption
which may be used to pass options to the java interpreter. If you run java -h
as mentioned, one of these options is -version:<value>
.
It looks like the jarsigner:sign
goal has an element for passing additional args to the command line. So I'd try adding
<arguments>-Jversion:1.5.0</arguments>
or something like that. (Maybe someone else can help with the specific format for that option, I've never had to do this.)