AW: AW: Special build for modules - how to?

2009-06-26 Thread Lewis, Eric

> What happens if you move the activation part also to the 
> parent? Hint: Maven
> cannot activate a profile from child to parent since the 
> profiles in the
> parent have already be processed when the child is 
> "interpreted". However,
> it is not clear to me if ${basedir} used in the parent is 
> relative to the
> parent's physical location or to the one of the child.

Ok, so as I described, we have the master POM, then as a child we have the 
project POM and then every module of course has its POM.
The problem is that the activation of the profile is in the master POM already, 
since I don't want to reconfigure it several times.
So the only place to activate it would be the project POM, but as you write, 
it's not possible to do that.

I don't think it's possible to configure a profile in some POM and then 
reference it (for instance for activation) in a child POM. But I could be 
wrong...  :-)

As for ${basedir}, according to some discussions I read in the mailing list 
archive, Maven properties are not resolved in profiles.


> 
> > Also, to be sure, I added help:active-profiles, but this 
> doesn't seem to
> > work in this case. For the successful build, it only lists 
> the profile
> > which is active by default
> > 
> > [INFO] [help:active-profiles]
> > [INFO]
> > Active Profiles for Project 'ch.ipi:util-di:jar:1.0.0-SNAPSHOT':
> > 
> > The following profiles are active:
> > 
> >  - local (source: settings.xml)
> >  - local (source: settings.xml)
> > 
> > (and God only knows why it's listed twice...)
> 
> Don't use "activeByDefault". Set it explicitly active in an 
> activeProfiles
> section. Hint: Normally a profile activated by default should 
> be not active
> if a different one is activated. However, it is not clear 
> what "another one
> is activated" really means: another one is activated by 
> command line or is
> activated by condition. Even worse that different maven 
> versions do behave
> differently in this respect ;-)

Thanks, I'm going to try this one of these days.

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



Re: AW: Special build for modules - how to?

2009-06-26 Thread Jörg Schaible
Lewis, Eric wrote at Freitag, 26. Juni 2009 11:36:

> Hi Jörg
> 
>> 
>> To get this right: You've defined the plugin in the profile
>> section of the
>> parent and you try to activate it in the individual modules?
> 
> Yes
> 
>> Interesting idea.
> 
> Thanks, but born out of sheer despair  ;-)
> I don't really know if this is how such builds are supposed to be done in
> Maven...
> 
>> Are you sure that it simply does not work in reactor,
>> because it is
>> looking for the file in the wrong working dir then? Did you try
>> ${basedir}/jaxb.profile ?
> 
> Thanks, good idea! I just tried it, just building the specific module, not
> the whole project.
> 
> osgi-bundle.profile
> 
> works:
> 
> [INFO] [compiler:compile]
> [INFO] Compiling 11 source files to 
> [INFO] [bundle:manifest {execution: bundle-manifest}]
> [INFO] [resources:testResources]
> 
> 
> However
> 
> ${basedir}/osgi-bundle.profile
> 
> doesn't work:
> 
> [INFO] [compiler:compile]
> [INFO] Compiling 11 source files to 
> [INFO] [resources:testResources]

What happens if you move the activation part also to the parent? Hint: Maven
cannot activate a profile from child to parent since the profiles in the
parent have already be processed when the child is "interpreted". However,
it is not clear to me if ${basedir} used in the parent is relative to the
parent's physical location or to the one of the child.

> Also, to be sure, I added help:active-profiles, but this doesn't seem to
> work in this case. For the successful build, it only lists the profile
> which is active by default
> 
> [INFO] [help:active-profiles]
> [INFO]
> Active Profiles for Project 'ch.ipi:util-di:jar:1.0.0-SNAPSHOT':
> 
> The following profiles are active:
> 
>  - local (source: settings.xml)
>  - local (source: settings.xml)
> 
> (and God only knows why it's listed twice...)

Don't use "activeByDefault". Set it explicitly active in an activeProfiles
section. Hint: Normally a profile activated by default should be not active
if a different one is activated. However, it is not clear what "another one
is activated" really means: another one is activated by command line or is
activated by condition. Even worse that different maven versions do behave
differently in this respect ;-)

- Jörg


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



AW: Special build for modules - how to?

2009-06-26 Thread Lewis, Eric
If I understand you correctly, you suggest configuring the plugins generally in 
the pluginManagement and then adding the plugin in the specific build in the 
module's POM?

If so, this is too simple for my case, because for instance the OSGi profile 
also reconfigures the maven-jar-plugin, since the maven-bundle-plugin creates 
its own MANIFEST.MF file (an OSGi one) which means that the JAR plugin must not 
create one itself, making its configuration different from the default 
configuration.

Best regards,
Eric 

> -Ursprüngliche Nachricht-
> Von: Benson Margulies [mailto:bimargul...@gmail.com] 
> Gesendet: Freitag, 26. Juni 2009 13:51
> An: Maven Users List
> Betreff: Re: Special build for modules - how to?
> 
> Set it up in pluginManagement instead of plugins in the parent?
> 
> On Fri, Jun 26, 2009 at 4:03 AM, Lewis, Eric wrote:
> > Hi
> >
> > We have a build which consists of several projects which 
> each consists of several modules. We also have a global 
> parent which defines how the build works.
> >
> > Now, I had the problem that some modules need special steps 
> in their build, e.g. JAXB2 generation, creating an OSGi module etc.
> >
> > Of course, I tried to stick to the Don't Repeat Yourself 
> principle and wanted to administer these special steps 
> myself, instead of leaving it to the individual developers to 
> copy & paste the build configuration over and over.
> >
> > Since including parts of XML into a POM seems to be 
> impossible, I did it with profiles. For example:
> >
> >    
> >    
> >      jaxb
> >      
> >        
> >          
> >            org.jvnet.jaxb2.maven2
> >            maven-jaxb2-plugin
> >            
> >              
> >                
> >                  generate
> >                
> >              
> >            
> >            
> >              
> ${jaxb.schema.directory}
> >              ${jaxb.package}
> >              true
> >              true
> >            
> >          
> >        
> >      
> >      
> >        
> src/main/resources
> >        ch.ipi.${project.artifactId}.xml
> >      
> >    
> >
> > Now, if a module wants to use JAXB2, it just has to specify 
> -Pjaxb; so far, so good.
> >
> > I thought this was a nifty solution, but there's a problem 
> with reactor builds: Let's say that I want to build the whole 
> project (modules A, B, C), and module A needs JAXB 
> generation, module B needs an OSGi build etc.
> >
> > The only way I saw until recently was to specify all the 
> profiles required by all the modules when building the whole 
> project. However, for some plugins, this fails miserably, 
> since the plugin *expects* to see certain files, and if it 
> doesn't have them, it breaks the build. Besides, I tell every 
> module to do these special steps, and they only don't execute 
> them because some file/directory is missing (e.g. the XML 
> schema directory), which for me is kind of shaky...
> >
> > The best thing for me would have been to activate a profile 
> based on a Maven property, so I could set the property it in 
> the module's POM. Alas, this idea doesn't work, since Maven 
> only activates profiles based on system properties.
> >
> > Next, I tried activating using files, something like
> >
> >    
> >    
> >      jaxb
> >      
> >        
> >          jaxb.profile
> >        
> >      
> > ...
> >
> > So, module A has a file 'jaxb.profile' in its root 
> directory, module B has 'osgi.profile' etc. This works well 
> on an individual module level, but as soon as I build the 
> whole project, it's totally ignored by the reactor.
> >
> >
> > In other words, I'm stuck!
> >
> > Does anyone have the same kind of build that we have and 
> what's your solution? Is my idea of using profiles for this a 
> valid one or am I totally off "the Maven way"?
> >
> > Should I file a request for enhancement that profiles 
> should be activated by Maven properties?
> >
> >
> > Best regards,
> > Eric
> > 
> -
> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > For additional commands, e-mail: users-h...@maven.apache.org
> >
> >
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
> 
> 
-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Special build for modules - how to?

2009-06-26 Thread Benson Margulies
Set it up in pluginManagement instead of plugins in the parent?

On Fri, Jun 26, 2009 at 4:03 AM, Lewis, Eric wrote:
> Hi
>
> We have a build which consists of several projects which each consists of 
> several modules. We also have a global parent which defines how the build 
> works.
>
> Now, I had the problem that some modules need special steps in their build, 
> e.g. JAXB2 generation, creating an OSGi module etc.
>
> Of course, I tried to stick to the Don't Repeat Yourself principle and wanted 
> to administer these special steps myself, instead of leaving it to the 
> individual developers to copy & paste the build configuration over and over.
>
> Since including parts of XML into a POM seems to be impossible, I did it with 
> profiles. For example:
>
>    
>    
>      jaxb
>      
>        
>          
>            org.jvnet.jaxb2.maven2
>            maven-jaxb2-plugin
>            
>              
>                
>                  generate
>                
>              
>            
>            
>              ${jaxb.schema.directory}
>              ${jaxb.package}
>              true
>              true
>            
>          
>        
>      
>      
>        src/main/resources
>        ch.ipi.${project.artifactId}.xml
>      
>    
>
> Now, if a module wants to use JAXB2, it just has to specify -Pjaxb; so far, 
> so good.
>
> I thought this was a nifty solution, but there's a problem with reactor 
> builds: Let's say that I want to build the whole project (modules A, B, C), 
> and module A needs JAXB generation, module B needs an OSGi build etc.
>
> The only way I saw until recently was to specify all the profiles required by 
> all the modules when building the whole project. However, for some plugins, 
> this fails miserably, since the plugin *expects* to see certain files, and if 
> it doesn't have them, it breaks the build. Besides, I tell every module to do 
> these special steps, and they only don't execute them because some 
> file/directory is missing (e.g. the XML schema directory), which for me is 
> kind of shaky...
>
> The best thing for me would have been to activate a profile based on a Maven 
> property, so I could set the property it in the module's POM. Alas, this idea 
> doesn't work, since Maven only activates profiles based on system properties.
>
> Next, I tried activating using files, something like
>
>    
>    
>      jaxb
>      
>        
>          jaxb.profile
>        
>      
> ...
>
> So, module A has a file 'jaxb.profile' in its root directory, module B has 
> 'osgi.profile' etc. This works well on an individual module level, but as 
> soon as I build the whole project, it's totally ignored by the reactor.
>
>
> In other words, I'm stuck!
>
> Does anyone have the same kind of build that we have and what's your 
> solution? Is my idea of using profiles for this a valid one or am I totally 
> off "the Maven way"?
>
> Should I file a request for enhancement that profiles should be activated by 
> Maven properties?
>
>
> Best regards,
> Eric
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

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



AW: Special build for modules - how to?

2009-06-26 Thread Lewis, Eric
Hi Jörg

> 
> To get this right: You've defined the plugin in the profile 
> section of the
> parent and you try to activate it in the individual modules? 

Yes

> Interesting idea.

Thanks, but born out of sheer despair  ;-)
I don't really know if this is how such builds are supposed to be done in 
Maven...

> Are you sure that it simply does not work in reactor, 
> because it is
> looking for the file in the wrong working dir then? Did you try
> ${basedir}/jaxb.profile ?

Thanks, good idea! I just tried it, just building the specific module, not the 
whole project.

osgi-bundle.profile

works:

[INFO] [compiler:compile]
[INFO] Compiling 11 source files to 
[INFO] [bundle:manifest {execution: bundle-manifest}]
[INFO] [resources:testResources]


However 

${basedir}/osgi-bundle.profile

doesn't work:

[INFO] [compiler:compile]
[INFO] Compiling 11 source files to 
[INFO] [resources:testResources]


Also, to be sure, I added help:active-profiles, but this doesn't seem to work 
in this case. For the successful build, it only lists the profile which is 
active by default

[INFO] [help:active-profiles]
[INFO] 
Active Profiles for Project 'ch.ipi:util-di:jar:1.0.0-SNAPSHOT': 

The following profiles are active:

 - local (source: settings.xml)
 - local (source: settings.xml)

(and God only knows why it's listed twice...)

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



Re: Special build for modules - how to?

2009-06-26 Thread Jörg Schaible
Lewis, Eric wrote at Freitag, 26. Juni 2009 10:03:

> Hi
> 
> We have a build which consists of several projects which each consists of
> several modules. We also have a global parent which defines how the build
> works.
> 
> Now, I had the problem that some modules need special steps in their
> build, e.g. JAXB2 generation, creating an OSGi module etc.
> 
> Of course, I tried to stick to the Don't Repeat Yourself principle and
> wanted to administer these special steps myself, instead of leaving it to
> the individual developers to copy & paste the build configuration over and
> over.
> 
> Since including parts of XML into a POM seems to be impossible, I did it
> with profiles. For example:
> 
>  
>   jaxb
>   
> 
>   
> org.jvnet.jaxb2.maven2
> maven-jaxb2-plugin
> 
>   
> 
>   generate
> 
>   
> 
> 
>   ${jaxb.schema.directory}
>   ${jaxb.package}
>   true
>   true
> 
>   
> 
>   
>   
> src/main/resources
> ch.ipi.${project.artifactId}.xml
>   
> 
> 
> Now, if a module wants to use JAXB2, it just has to specify -Pjaxb; so
> far, so good.
> 
> I thought this was a nifty solution, but there's a problem with reactor
> builds: Let's say that I want to build the whole project (modules A, B,
> C), and module A needs JAXB generation, module B needs an OSGi build etc.
> 
> The only way I saw until recently was to specify all the profiles required
> by all the modules when building the whole project. However, for some
> plugins, this fails miserably, since the plugin *expects* to see certain
> files, and if it doesn't have them, it breaks the build. Besides, I tell
> every module to do these special steps, and they only don't execute them
> because some file/directory is missing (e.g. the XML schema directory),
> which for me is kind of shaky...
> 
> The best thing for me would have been to activate a profile based on a
> Maven property, so I could set the property it in the module's POM. Alas,
> this idea doesn't work, since Maven only activates profiles based on
> system properties.
> 
> Next, I tried activating using files, something like
> 
>  
>   jaxb
>   
> 
>   jaxb.profile
> 
>   
> ...
> 
> So, module A has a file 'jaxb.profile' in its root directory, module B has
> 'osgi.profile' etc. This works well on an individual module level, but as
> soon as I build the whole project, it's totally ignored by the reactor.

To get this right: You've defined the plugin in the profile section of the
parent and you try to activate it in the individual modules? Interesting
idea. Are you sure that it simply does not work in reactor, because it is
looking for the file in the wrong working dir then? Did you try
${basedir}/jaxb.profile ?

- Jörg



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



Special build for modules - how to?

2009-06-26 Thread Lewis, Eric
Hi

We have a build which consists of several projects which each consists of 
several modules. We also have a global parent which defines how the build works.

Now, I had the problem that some modules need special steps in their build, 
e.g. JAXB2 generation, creating an OSGi module etc.

Of course, I tried to stick to the Don't Repeat Yourself principle and wanted 
to administer these special steps myself, instead of leaving it to the 
individual developers to copy & paste the build configuration over and over.

Since including parts of XML into a POM seems to be impossible, I did it with 
profiles. For example:



  jaxb
  

  
org.jvnet.jaxb2.maven2
maven-jaxb2-plugin

  

  generate

  


  ${jaxb.schema.directory}
  ${jaxb.package}
  true
  true

  

  
  
src/main/resources
ch.ipi.${project.artifactId}.xml
  


Now, if a module wants to use JAXB2, it just has to specify -Pjaxb; so far, so 
good.

I thought this was a nifty solution, but there's a problem with reactor builds: 
Let's say that I want to build the whole project (modules A, B, C), and module 
A needs JAXB generation, module B needs an OSGi build etc.

The only way I saw until recently was to specify all the profiles required by 
all the modules when building the whole project. However, for some plugins, 
this fails miserably, since the plugin *expects* to see certain files, and if 
it doesn't have them, it breaks the build. Besides, I tell every module to do 
these special steps, and they only don't execute them because some 
file/directory is missing (e.g. the XML schema directory), which for me is kind 
of shaky...

The best thing for me would have been to activate a profile based on a Maven 
property, so I could set the property it in the module's POM. Alas, this idea 
doesn't work, since Maven only activates profiles based on system properties.

Next, I tried activating using files, something like



  jaxb
  

  jaxb.profile

  
...

So, module A has a file 'jaxb.profile' in its root directory, module B has 
'osgi.profile' etc. This works well on an individual module level, but as soon 
as I build the whole project, it's totally ignored by the reactor.


In other words, I'm stuck!

Does anyone have the same kind of build that we have and what's your solution? 
Is my idea of using profiles for this a valid one or am I totally off "the 
Maven way"?

Should I file a request for enhancement that profiles should be activated by 
Maven properties?


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