Re: Can't figure out how to filter resources

2012-06-10 Thread Jason van Zyl
It was arbitrary and probably not the best decision, but due to the frequency 
of compiling, processing resources and testing it was given a special place in 
the POM. Additionally because those directories are referenced more often by 
several plugins. Thought was to reduce the boiler plate in the POM, but we 
should have made plugin inheritance work properly and references to shared 
values a little better. Things will likely move in the direction of the site 
plugin where the special configuration is removed from the POM proper and 
pushed out into the respective plugin configuration block.

On Jun 9, 2012, at 9:59 PM, Brian Topping wrote:

 
 On Jun 9, 2012, at 9:53 PM, Jason van Zyl wrote:
 
 Note that filtering resources is one of the special plugins that is 
 configured in the POM itself. 
 
 As an academic question, what is the reason for the special plugins like 
 this?  I was teaching a 3-day Maven class a few weeks ago and I couldn't 
 explain why it was this way other than some kind of hangover from m1 (but 
 couldn't remember my m1 well enough to say authoritatively).  
 
 Cheers, Brian
 -
 To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
 For additional commands, e-mail: users-h...@maven.apache.org
 

Thanks,

Jason

--
Jason van Zyl
Founder  CTO, Sonatype
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

A party which is not afraid of letting culture,
business, and welfare go to ruin completely can
be omnipotent for a while.

  -- Jakob Burckhardt







Re: Can't figure out how to filter resources

2012-06-10 Thread Jason van Zyl
Ah, I see. Yes, if you've looked at other plugin configuration examples the 
ellipses in this example might be construed as a plugin block as well. 

The full literal block to filter is like this:

project
  !-- All your other POM configuration --
  build
resources
  resource
directorysrc/main/resources/directory
filteringtrue/filtering
  /resource
/resources
  /build
/project

On Jun 9, 2012, at 11:02 PM, Patrick wrote:

 Sorry, but I must be missing something.  I'd already read through that many 
 times, and that's how I got this.  I thought I showed you how I was 
 configuring it in the POM itself.  I would assume the confusion is caused by 
 all those ... sections which REALLY make the example unclear.
 
 On Jun 9, 2012, at 6:53 PM, Jason van Zyl wrote:
 
 http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html
 
 Note that filtering resources is one of the special plugins that is 
 configured in the POM itself. 
 
 On Jun 9, 2012, at 9:11 PM, Patrick wrote:
 
 I can't get the Maven resources plugin to filter.  Any advice?  I've looked 
 through the documentation, but I can't find any complete examples.  Below 
 it what I've managed to piece together, but it doesn't work.
 
 ./pom.xml:
 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;
 modelVersion4.0.0/modelVersion
 
 nameseeingi-lib/name
 groupIdorg.seeingi/groupId
 artifactIdseeingi-lib/artifactId
 version1.0-SNAPSHOT/version
 packagingjar/packaging
 
 build
  plugins
plugin
  groupIdorg.apache.maven.plugins/groupId
  artifactIdmaven-resources-plugin/artifactId
  version2.5/version
  configuration
resources
  resource
directorysrc/main/resources/directory
filteringtrue/filtering
  /resource
/resources
  /configuration
/plugin
  /plugins
 /build
 
 /project
 
 
 ./src/main/resources/hello.txt:
 Hello @name@
 Hello ${name}
 
 
 Expected at ./target/classes/hello.txt:
 Hello seeingi-lib
 Hello seeingi-lib
 
 
 Actual at ./target/classes/hello.txt:
 Hello @name@
 Hello ${name}
 
 
 Notes:
 I've tested this on MacOS and windows.  Windows I used Netbeans, and on 
 MacOS I used mvn install.  (MacPorts version Apache Maven 3.0.3 
 (r1075438; 2011-02-28 09:31:09-0800)
 
 
 Does anyone what I'm doing wrong, or a working and complete example?
 
 Thanks,
 
 Jason
 
 --
 Jason van Zyl
 Founder  CTO, Sonatype
 Founder,  Apache Maven
 http://twitter.com/jvanzyl
 -
 
 In short, man creates for himself a new religion of a rational
 and technical order to justify his work and to be justified in it.
 
 -- Jacques Ellul, The Technological Society
 
 
 
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
 For additional commands, e-mail: users-h...@maven.apache.org
 

Thanks,

Jason

--
Jason van Zyl
Founder  CTO, Sonatype
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

What matters is not ideas, but the people who have them. Good people can fix 
bad ideas, but good ideas can't save bad people. 

 -- Paul Graham







Re: How to use PluginContext() method of AbstractMojo or ContextEnabled for custom Mojos?

2012-06-10 Thread Tonté Pouncil
How do I do this?

Thanks.

On Jun 9, 2012, at 9:42 PM, Dan Tran wrote:

 your mojos may need to be related in a maven lifecycle extension
 
 -D
 
 On Sat, Jun 9, 2012 at 7:29 PM, Tonté Pouncil
 pouncilt.develo...@gmail.com wrote:
 Yes.  I have already tried to set the context map with my Mojo and retrieve 
 it with my other Mojo; but it is still null.
 
 Okay I will look at native-maven-plugin and see what they are doing?
 
 I create an abstract class that has a static variable that hold my object 
 that both Mojos can access.
 
 Thanks!
 
 Tonté
 On Jun 9, 2012, at 6:45 PM, Dan Tran wrote:
 
 see native-maven-plugin at MOJO, you can find pluginContext usage there
 
 -D
 
 On Sat, Jun 9, 2012 at 1:52 PM, Aliaksei Lahachou
 aliaksei.lahac...@googlemail.com wrote:
 Hi,
 
 have you tried to setPluginContext with a map that you instantiate yourself
 and see if it's available in mojo2?
 
 
 Regards,
 htfv (Aliaksei Lahachou)
 
 
 On Fri, Jun 8, 2012 at 1:36 PM, Tonté Pouncil
 pouncilt.develo...@gmail.comwrote:
 
 Hello,
 
 I am trying to get two custom Mojos that I have created to communicate
 with each other.  Mojo1 creates an object that I want to be available when
 Mojo2 executes.  How do I do this?
 
 I've been trying to use
 org.apache.maven.plugin.AbstractMojo#set/getPluginContext() method and
 org.apache.mavin.plugin.ContextEnabled.  But so far the context is null.
 
 Thank you.
 
 Tonté
 -
 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
 
 
 -
 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: Can't figure out how to filter resources

2012-06-10 Thread Patrick
Thank you.  It's working perfectly now.

Now, how would I go about trying to improve the documentation?  I thought that 
it should either have a note explicitly mentioning that the resources section 
does not go in a plugin block, or the first pom.xml should have the ellipses 
removes, and it should be listed as a complete example.

On Jun 10, 2012, at 4:26 AM, Jason van Zyl wrote:

 Ah, I see. Yes, if you've looked at other plugin configuration examples the 
 ellipses in this example might be construed as a plugin block as well. 
 
 The full literal block to filter is like this:
 
 project
  !-- All your other POM configuration --
  build
resources
  resource
directorysrc/main/resources/directory
filteringtrue/filtering
  /resource
/resources
  /build
 /project
 
 On Jun 9, 2012, at 11:02 PM, Patrick wrote:
 
 Sorry, but I must be missing something.  I'd already read through that many 
 times, and that's how I got this.  I thought I showed you how I was 
 configuring it in the POM itself.  I would assume the confusion is caused by 
 all those ... sections which REALLY make the example unclear.
 
 On Jun 9, 2012, at 6:53 PM, Jason van Zyl wrote:
 
 http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html
 
 Note that filtering resources is one of the special plugins that is 
 configured in the POM itself. 
 
 On Jun 9, 2012, at 9:11 PM, Patrick wrote:
 
 I can't get the Maven resources plugin to filter.  Any advice?  I've 
 looked through the documentation, but I can't find any complete examples.  
 Below it what I've managed to piece together, but it doesn't work.
 
 ./pom.xml:
 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;
 modelVersion4.0.0/modelVersion
 
 nameseeingi-lib/name
 groupIdorg.seeingi/groupId
 artifactIdseeingi-lib/artifactId
 version1.0-SNAPSHOT/version
 packagingjar/packaging
 
 build
 plugins
   plugin
 groupIdorg.apache.maven.plugins/groupId
 artifactIdmaven-resources-plugin/artifactId
 version2.5/version
 configuration
   resources
 resource
   directorysrc/main/resources/directory
   filteringtrue/filtering
 /resource
   /resources
 /configuration
   /plugin
 /plugins
 /build
 
 /project
 
 
 ./src/main/resources/hello.txt:
 Hello @name@
 Hello ${name}
 
 
 Expected at ./target/classes/hello.txt:
 Hello seeingi-lib
 Hello seeingi-lib
 
 
 Actual at ./target/classes/hello.txt:
 Hello @name@
 Hello ${name}
 
 
 Notes:
 I've tested this on MacOS and windows.  Windows I used Netbeans, and on 
 MacOS I used mvn install.  (MacPorts version Apache Maven 3.0.3 
 (r1075438; 2011-02-28 09:31:09-0800)
 
 
 Does anyone what I'm doing wrong, or a working and complete example?
 
 Thanks,
 
 Jason
 
 --
 Jason van Zyl
 Founder  CTO, Sonatype
 Founder,  Apache Maven
 http://twitter.com/jvanzyl
 -
 
 In short, man creates for himself a new religion of a rational
 and technical order to justify his work and to be justified in it.
 
 -- Jacques Ellul, The Technological Society
 
 
 
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
 For additional commands, e-mail: users-h...@maven.apache.org
 
 
 Thanks,
 
 Jason
 
 --
 Jason van Zyl
 Founder  CTO, Sonatype
 Founder,  Apache Maven
 http://twitter.com/jvanzyl
 -
 
 What matters is not ideas, but the people who have them. Good people can fix 
 bad ideas, but good ideas can't save bad people. 
 
 -- Paul Graham
 
 
 
 
 


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



Re: Can't figure out how to filter resources

2012-06-10 Thread Brian Topping

On Jun 10, 2012, at 11:57 AM, Patrick wrote:

 Now, how would I go about trying to improve the documentation?  I thought 
 that it should either have a note explicitly mentioning that the resources 
 section does not go in a plugin block, or the first pom.xml should have the 
 ellipses removes, and it should be listed as a complete example.

Good sentiments, but the ellipses convention is used elsewhere around teh 
internets as well.  Further, basic knowledge of XML tree structure precludes 
having both data and other elements as children of an element, something this 
documentation convention clearly violates.  In other words, it should stand out 
as something obviously used for illustration.

As far as complete examples, your contributions might be useful in 
http://maven.apache.org/plugins/maven-resources-plugin/usage.html, but one of 
the benefits of the current documentation format is people can find what they 
need fast, without the clutter of having to wade through complete examples in 
every situation.  It may not suit your taste, but work with it for a while and 
you'll get used to it.

Finally, don't forget how important it is to search projects that successfully 
use Maven for example code.  Even the resources plugin source itself has 
integration tests that demonstrate the different features and how to configure 
for them.

Hope that helps!

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



Re: Can't figure out how to filter resources

2012-06-10 Thread Patrick

On Jun 10, 2012, at 9:42 AM, Brian Topping wrote:

 
 On Jun 10, 2012, at 11:57 AM, Patrick wrote:
 
 Now, how would I go about trying to improve the documentation?  I thought 
 that it should either have a note explicitly mentioning that the resources 
 section does not go in a plugin block, or the first pom.xml should have the 
 ellipses removes, and it should be listed as a complete example.
 
 Good sentiments, but the ellipses convention is used elsewhere around teh 
 internets as well.  Further, basic knowledge of XML tree structure precludes 
 having both data and other elements as children of an element, something this 
 documentation convention clearly violates.  In other words, it should stand 
 out as something obviously used for illustration.
 
 As far as complete examples, your contributions might be useful in 
 http://maven.apache.org/plugins/maven-resources-plugin/usage.html, but one of 
 the benefits of the current documentation format is people can find what they 
 need fast, without the clutter of having to wade through complete examples in 
 every situation.  It may not suit your taste, but work with it for a while 
 and you'll get used to it.
 

True, but in that case my other suggestion of adding a note explicitly 
mentioning it would be useful. Something like:
Unlike most other plugins, some of the config for maven-resources-plugin plugin 
is NOT put in [plugin][/plugin] section.  (BBCode used so mail programs don't 
choke)

Thoughts?

 Finally, don't forget how important it is to search projects that 
 successfully use Maven for example code.  Even the resources plugin source 
 itself has integration tests that demonstrate the different features and how 
 to configure for them.

True.  I tried that, but most were so big that I was blinded by assumption that 
all config goes in the plugin section.
-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



list of phases defined by the lifecycle of a packaging type

2012-06-10 Thread Pascal Rapicault
Hi,

Given a packaging type, is there a way to programmatically know all the phases 
that are associated with the various lifecycle?

For example during the execution with -X I see the following output. This is 
pretty much what I want.

[DEBUG] Lifecycle clean - [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site - [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default - [validate, initialize, generate-sources, 
process-sources, generate-resources, process-resources, compile, 
process-classes, generate-test-sources, process-test-sources, 
generate-test-resources, process-test-resources, test-compile, 
process-test-classes, test, prepare-package, package, pre-integration-test, 
integration-test, post-integration-test, verify, install, deploy]

Thx in advance,

Pascal

Re: list of phases defined by the lifecycle of a packaging type

2012-06-10 Thread Milos Kleint
public ListString getLifecyclePhases() {

LifecycleMapping lifecycleMapping =
lookupComponent(LifecycleMapping.class);
if (lifecycleMapping != null) {
SetString phases = new TreeSetString();
MapString, Lifecycle lifecycles =
lifecycleMapping.getLifecycles();
for (Lifecycle lifecycle : lifecycles.values()) {
phases.addAll(lifecycle.getPhases().keySet());
}
return new ArrayListString(phases);
}

return Collections.StringemptyList();
}

is what we use for certain code completions in netbeans..

Milos

On Sun, Jun 10, 2012 at 9:48 PM, Pascal Rapicault pas...@rapicault.net wrote:
 Hi,

 Given a packaging type, is there a way to programmatically know all the 
 phases that are associated with the various lifecycle?

 For example during the execution with -X I see the following output. This is 
 pretty much what I want.

 [DEBUG] Lifecycle clean - [pre-clean, clean, post-clean]
 [DEBUG] Lifecycle site - [pre-site, site, post-site, site-deploy]
 [DEBUG] Lifecycle default - [validate, initialize, generate-sources, 
 process-sources, generate-resources, process-resources, compile, 
 process-classes, generate-test-sources, process-test-sources, 
 generate-test-resources, process-test-resources, test-compile, 
 process-test-classes, test, prepare-package, package, pre-integration-test, 
 integration-test, post-integration-test, verify, install, deploy]

 Thx in advance,

 Pascal

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