RE: [EXTERNAL] RE: profile activation with multiple conditions

2015-11-16 Thread Jörg Schaible
Hi Justin,

Justin Georgeson wrote:

> Thanks. I was hoping that it would evaluate the file-based activation per
> project. I was treating it as a separate issue than the multiple
> conditions. But I think what you're saying is that the profile activation
> happens once for the whole reactor, and not per project within the
> reactor. I gather that you're saying if the keystore file doesn't exist
> when I first run maven, then the keystore profile will be activated for
> all projects in the reactor. Is that correct?

Yes. I've verified this with 3.3.9 and 3.2.5. Fails for 3.1.1, i.e. 3.1.1 
implements OR.

> I'm still seeing the
> keystore profile activate from the property alone even if the keystore
> file already exists before I run the mvn command. So that still suggests
> that it's doing an or of the conditions rather than an and. Running 'mvn
> -N -X help:active-profiles -Djarsigner.keystore.scm.url' isn't giving any
> debug info on the profile activation unfortunately.

Keep in mind, that activation is resolved on base of the location of the 
current project's POM, i.e. if your file-based activation uses a relative 
path that is only valid from the parent POM's directory, it does not work 
for the projects inheriting that parent. E.g. a profile declared in a parent 
POM activated on existence of src/main/java will be active for any current 
project compiling Java sources for the main artifact.

> My goal here is to have as much of the build process as possible
> self-contained in the POM files and executed from a single mvn command.

Why don't you simply activate the profile based on the property only and 
declare in this profile the keystore as (provided) dependency, copying it 
with the dependency plugin somewhere to target and configure the jarsigner 
plugin to use it from that location (plugins also defined in this' profile 
settings)?

Cheers,
Jörg


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



RE: profile activation with multiple conditions

2015-11-10 Thread Justin Georgeson
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
> >
> > 
> > 
> > jarsigner.keystore.scm.url
> > 
> > 
> > ${keystore.dir}
> > 
> > 
> >
> > 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=CwIFAg=PskvixtEUDK7wuWU-
> >
> tIg6oKuGYBRbrMXk2FZvF0UfTo=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEm
> >
> BCjCmEiTk=qSnekx007UIfFuC5Su7wwnAxDOG6yBCpBC5PyZFv2d0=ypg5E
> > ApiZkSAidXlZV394CNaIG3j8JF9HTM0DLm3rRQ=
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org

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;>
4.0.0
com.lgc
parent
1.0.0-SNAPSHOT
pom

module1
module2



keystore


jarsigner.keystore.scm.url


${user.dir}/target/keystore/iacode.keystore





maven-scm-plugin
1.9.1


scm-get-keystore
prepare-package

export


${jarsigner.keystore.scm.url}
${user.dir}/target/keystore
${jarsigner.keystore.scm.user}
${jarsigner.keystore.scm.password}








jarsigner


${user.dir}/target/keystore/iacode.keystore





org.apache.maven.plugins
maven-jarsigner-plugin
1.3.2


RE: profile activation with multiple conditions

2015-11-10 Thread Jörg Schaible
Justin Georgeson wrote:

> 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.

Profile activation is quite the first thing Maven does. So, the file has to 
be already there when Maven starts.

Form your description I got the impression that you "create" somehow the 
file during the build and expects then that Maven takes it into 
consideration for profile activation. That will never happen. And this has 
nothing to do with multiple profile conditions.

Cheers,
Jörg


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



RE: [EXTERNAL] RE: profile activation with multiple conditions

2015-11-10 Thread Justin Georgeson
Thanks. I was hoping that it would evaluate the file-based activation per 
project. I was treating it as a separate issue than the multiple conditions. 
But I think what you're saying is that the profile activation happens once for 
the whole reactor, and not per project within the reactor. I gather that you're 
saying if the keystore file doesn't exist when I first run maven, then the 
keystore profile will be activated for all projects in the reactor. Is that 
correct? I'm still seeing the keystore profile activate from the property alone 
even if the keystore file already exists before I run the mvn command. So that 
still suggests that it's doing an or of the conditions rather than an and. 
Running 'mvn -N -X help:active-profiles -Djarsigner.keystore.scm.url' isn't 
giving any debug info on the profile activation unfortunately. 

My goal here is to have as much of the build process as possible self-contained 
in the POM files and executed from a single mvn command.

> -Original Message-
> From: Jörg Schaible [mailto:joerg.schai...@gmx.de]
> Sent: Tuesday, November 10, 2015 4:26 PM
> To: users@maven.apache.org
> Subject: [EXTERNAL] RE: profile activation with multiple conditions
> 
> Justin Georgeson wrote:
> 
> > 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.
> 
> Profile activation is quite the first thing Maven does. So, the file has to be
> already there when Maven starts.
> 
> Form your description I got the impression that you "create" somehow the file
> during the build and expects then that Maven takes it into consideration for
> profile activation. That will never happen. And this has nothing to do with
> multiple profile conditions.
> 
> Cheers,
> Jörg
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org



profile activation with multiple conditions

2015-11-06 Thread Justin Georgeson
I have a profile defined in my parent POM which I'm trying to activate like this



jarsigner.keystore.scm.url


${keystore.dir}



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://issues.apache.org/jira/browse/MNG-4565



RE: profile activation with multiple conditions

2015-11-06 Thread Justin Georgeson
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
> 
> 
> 
> jarsigner.keystore.scm.url
> 
> 
> ${keystore.dir}
> 
> 
> 
> 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=CwIFAg=PskvixtEUDK7wuWU-
> tIg6oKuGYBRbrMXk2FZvF0UfTo=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEm
> BCjCmEiTk=qSnekx007UIfFuC5Su7wwnAxDOG6yBCpBC5PyZFv2d0=ypg5E
> ApiZkSAidXlZV394CNaIG3j8JF9HTM0DLm3rRQ=


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org