I'm not sure if I can help out with the multiple keystores, but I can help
with not specifying an absolute path name.  If you use the properties that
are available in Maven2, for instance ${basedir} you won't have to specify
an absolute path name to your keystore.  

Just place ${basedir} inside of a property's value and then use that
property else where...for instance:

[code]
  <project>
   ...
          <properties>
             
<keystore.file>${basedir}/src/main/keystore/dev/keystorefile</keystore.file>
          </properties>
   ...
  </project>
pom.xml
[/code]

${basedir} will translate into an absolute path to the base directory of
your project (where ever it is)

Than when you configure the plugin for jar signing....
[code]
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
           <execution>
              <goals>
                 <goal>sign</goal>
              </goals>
           </execution>
        </executions>
        <configuration>
           <keystore>${keystore.file}</keystore>
           <alias>youralias</alias>
           <storepass>yourstorepassword</storepass>
          
<signedjar>${project.build.directory}/signed/${project.build.finalName}.jar</signedjar>
           <verify>true</verify>
        </configuration>
      </plugin>
[/code]
pom.xml 

...You specify the ${keystore.file} property we created above which places
that path to the keystore file.

But wait!  You say... You haven't specified how I can use a different
keystore for each type of build (dev/release)  I'm getting to that...

That's as easy as specifying a different value of the ${keystore.file}
property for a different build profile, and building using a particular 
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
build profile  (
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
build profile  might be dev/prod/release).

[code]
<profiles>
        <profile>
                <id>dev</id>
                <properties>
                        
<keystore.file>/src/main/keystore/dev/keystorefile</keystore.file>
                </properties>
        </profile>
        <profile>
                <id>prod</id>
                <properties>
                
<keystore.file>/src/main/keystore/prod/keystorefile</keystore.file>
                </properties>
        </profile>
[/code]
profiles.xml

In the example profiles.xml file above, I have specified two build profiles
(dev and prod).  Both of these 
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
build profiles  have their own unique values for their own ${keystore.file}
property.  This will specify which file is used as the keystore when the
build profile is used.  

How do we specify which 
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
build profile  is used?  
It's very simple...when your run your mvn goal, just specify to maven2 which
build profile you want to use.

If I wanted to use the build profile with an id of dev profile above I would
type
[code]
mvn help:active-profiles -P dev
[/code]

If I wanted to use the build profile with an id of prod profile above I
would type
[code]
mvn help:active-profiles -P prod
[/code]

(You can replace the help:active-profiles goal with any goal you might use
in your project)
I just used the goal help:active-profiles to display which profile(s) are
being used.

Note that the values of the properties in profiles.xml override the
properties in pom.xml

And that's how you specify it.


Henrik Dohlmann wrote:
> 
> Yes, I know about the jar plugin. That what I would use to do the actual
> signing of a single jar.
> But, it is the handling of multiple keystores/keys for dev/release use and
> their placements I am interested in. Especially if there is some fancy way
> to create a project with the keystore/keys in and depend upon it somehow
> so that the signing can use these keys in a smart way, without the need of
> specifying any absolute path-names.
> 
> /Henrik
> 
>>-----Original Message-----
>>From: leeand00 [mailto:[EMAIL PROTECTED]
>>Sent: 23. oktober 2007 22:00
>>
>>Have you checked out the maven 2 jar plugin?
>>http://maven.apache.org/plugins/maven-jar-plugin/
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Keystores-and-signing-tf4677693.html#a13384754
Sent from the mojo - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to