So here's a minimal parent pom.xml, which lists 2 child modules that I created 
with 'mvn archetype:generate' choosing the 'maven-archetype-quickstart' 
archetype. My goal was that if I 

        mvn package

Then the compile/test/package occurs with no attempt to sign. But then by 
changing the command to 

        mvn package -Djarsigner.keystore.scm.url=... 
-Djarsigner.keystore.scm.user=... -Djarsigner.keystore.scm.password=... \
             -Djarsigner.storepass=...

Then it checks out a single copy of the keystore during the package phase of 
the parent project, and the jarsigner profile automatically activates during 
each of the modules due to the presence of the keystore file.

Instead it's deleting the keystore and checking out the keystore file during 
every project (or instead of and of profile activation conditions), and the 
jarsigner profile is not automatically activated.

> -----Original Message-----
> From: Justin Georgeson [mailto:jgeorge...@lgc.com]
> Sent: Friday, November 06, 2015 9:39 AM
> To: Maven Users List
> Subject: [EXTERNAL] RE: profile activation with multiple conditions
> 
> Sorry about that crazy URL, I think that's a network security service my
> employer just signed up with.
> 
> > -----Original Message-----
> > From: Justin Georgeson [mailto:jgeorge...@lgc.com]
> > Sent: Friday, November 06, 2015 9:34 AM
> > To: users@maven.apache.org
> > Subject: [EXTERNAL] profile activation with multiple conditions
> >
> > I have a profile defined in my parent POM which I'm trying to activate
> > like this
> >
> >             <activation>
> >                 <property>
> >                     <name>jarsigner.keystore.scm.url</name>
> >                 </property>
> >                 <file>
> >                     <missing>${keystore.dir}</missing>
> >                 </file>
> >             </activation>
> >
> > The goal is that when run with -Djarsigner.keystore.scm.url the
> > keystore will be checked out from SCM, but I don't want it to do that
> > for every module in a multi-module build. I thought that activation
> > was switched from OR to AND in 3.2.2[1] but I'm using 3.2.5 and I'm
> > seeing this profile as active when the property is set even though the
> > path exists. I thought maybe it's because ${keystore.dir} is a folder
> > instead of a file, so I tried it with a file but that had no effect. I
> > can work around it by having an extra checkout in the CI configuration
> > but I'd prefer to keep it self-contained in the 'mvn package' lifecycle of 
> > the
> build.
> >
> > [1] https://urldefense.proofpoint.com/v2/url?u=https-
> > 3A__issues.apache.org_jira_browse_MNG-
> > 2D4565&d=CwIFAg&c=PskvixtEUDK7wuWU-
> >
> tIg6oKuGYBRbrMXk2FZvF0UfTo&r=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEm
> >
> BCjCmEiTk&m=qSnekx007UIfFuC5Su7wwnAxDOG6yBCpBC5PyZFv2d0&s=ypg5E
> > ApiZkSAidXlZV394CNaIG3j8JF9HTM0DLm3rRQ&e=
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org

<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.lgc</groupId>
    <artifactId>parent</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <modules>
        <module>module1</module>
        <module>module2</module>
    </modules>
    <profiles>
        <profile>
            <id>keystore</id>
            <activation>
                <property>
                    <name>jarsigner.keystore.scm.url</name>
                </property>
                <file>
                    <missing>${user.dir}/target/keystore/iacode.keystore</missing>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-scm-plugin</artifactId>
                        <version>1.9.1</version>
                        <executions>
                            <execution>
                                <id>scm-get-keystore</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>export</goal>
                                </goals>
                                <configuration>
                                    <connectionUrl>${jarsigner.keystore.scm.url}</connectionUrl>
                                    <exportDirectory>${user.dir}/target/keystore</exportDirectory>
                                    <username>${jarsigner.keystore.scm.user}</username>
                                    <password>${jarsigner.keystore.scm.password}</password>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jarsigner</id>
            <activation>
                <file>
                    <exists>${user.dir}/target/keystore/iacode.keystore</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jarsigner-plugin</artifactId>
                        <version>1.3.2</version>
                        <executions>
                            <execution>
                                <id>sign</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <keystore>${user.dir}/target/keystore/iacode.keystore</keystore>
                            <alias>iasigncode</alias>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to