Re: Maven inheritence works with 2.1-SNAPSHOT but not with 2.0.9

2009-01-21 Thread kukudas

Thanks for the clearing Brian,

i have read your tutorial and it seems a good approach, however i thought
about an alternative aproach maybe you can give me your opinion about it.

What i want to archive is simply that i fetch every duplicate configuration
within my projects make a parent pom and inherit those things to them. 

With this i will save redundency and i think my configuration files will be
better to read. 

My problem was that with this aproach i could not set the path for a custom
xml file which would contain my checkstyle rules within the parents
reporting node, because when i inherited the xml file which was reachable in
the parent is not in the children. 

For example in my parent project the custom.xml file (for checkstyle) was in
src/main/resources and my parent pom referenced to it. When inherited this
for the child, the child will look in his own src/main/resources and not
into the parents one which is pretty clear will result into a file not found
exception unless i inherit somehow those xml files too.

So my first guess was i need to somehow inherit those xml files too or make
them available on compile/run time which i thought would work as i descirbed
in my first posting, the problem is that i now found out (with your help)
that it isnt possible,  because i have to use packaging pom and can not
provide a jar.

However i could just do it like this:

plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-checkstyle-plugin/artifactId
configuration
configLocationfile:../checkstyle.xml/configLocation
/configuration
/plugin

placing the custom checkstyle.xml on a server so every project which
inherits this can access it.
I don't know if this aproach brings any disadvantages or is recommendable
for my use case.

Thanks kukudas.


Brian E Fox wrote:
 
 You found a bug in 2.1-SNAPSHOT. The parents must be pom packaging types.
 
 If you want to share checkstyle, just bundle it into a jar with assembly,
 and then you can add that jar as a dependency to your checkstyle config.
 You
 don't need to inherit from the checkstyle jar itself, Checkstyle will find
 the xml on the classpath. I wrote some examples about this here:
 http://blogs.sonatype.com/people/2008/04/how-to-share-resources-across-proje
 cts-in-maven/
 
 http://blogs.sonatype.com/people/2008/04/how-to-override-a-plugins-dependenc
 y-in-maven/
 
 --Brian 
 
 On 1/20/09 8:03 AM, kukudas kukuda...@googlemail.com wrote:
 
 Hi,
 
 i have a problem and i hope somebody can help me. I'm kinda new to this
 things so maybe my approach is generaly wrong.
 
 i'm having a parent for example like this:
 
 modelVersion4.0.0/modelVersion
 groupIdorg.test/groupId
 artifactIdparent/artifactId
 version1/version
 build
 plugin
 groupIdorg.apache.maven.plugins/groupId
 artifactIdmaven-checkstyle-plugin/artifactId
 dependencies
 dependency
 groupId${pom.parent.groupId}/groupId
 artifactId${pom.parent.artifactId}/artifactId
 version${pom.parent.version}/version
 /dependency
 /dependencies
 /plugin
 reporting
 plugin
 groupIdorg.apache.maven.plugins/groupId
 artifactIdmaven-checkstyle-plugin/artifactId
 configuration
 configLocationcheckstyle.xml/configLocation
 /configuration
 /plugin
 /plugins
 /reporting
 /project
 
 And a child like this:
 
 parent
 groupIdorg.test/groupId
 artifactIdparent/artifactId
 version1/version
 /parent
 
 modelVersion4.0.0/modelVersion
 groupIdorg.test/groupId
 artifactIdchild/artifactId
 
 When i use Maven 2.0.9 i get the error that parent packaging has to be
 pom.
 But it has to be jar so my child can access the checkstyle.xml which is
 in
 the parent projects resource folder.
 With Maven 2.1-SNAPSHOT it works as expected (checkstyle runs with my
 rules
 which are in the parents resource folder). Is there maybe a better way to
 solve this or somehow make it work with both versions? I don't want to
 use
 packaging jar, run clean install for my parent and then change it to pom
 so
 that it will work with 2.0.9.
 
 
 Thanks in advance
 
 kukudas
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
 For additional commands, e-mail: users-h...@maven.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Maven-inheritence-works-with-2.1-SNAPSHOT-but-not-with-2.0.9-tp21562721p21579235.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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

Re: Maven inheritence works with 2.1-SNAPSHOT but not with 2.0.9

2009-01-21 Thread jieryn
Just thought I would chime in with yet another alternative approach, I
employ a solution slightly different than Brian's assembly solution.
It is possibly not to be considered clean by the Maven crocodiles. :-)

My top level enterprise parent pom has a few support modules
immediately in its SCM hierarchy. Some of these modules are nothing
more than configuration files, e.g. checkstyle.xml, stylesheet.css
(for maven-javadoc-plugin), etc. They are default packagingjar and
contain nothing but a src/main/resources/com/acme/base/filename.
Then, in the enterprise parent pom I do something like:

build
plugins
  plugin
artifactIdmaven-dependency-plugin/artifactId
executions
  execution
idExplode com.acme.base:common-config-checkstyle/id
phasegenerate-resources/phase
goals
  goalunpack/goal
/goals
configuration
  artifactItems
artifactItem
  groupIdcom.acme.base/groupId
  artifactIdcommon-config-checkstyle/artifactId
  overWritefalse/overWrite
  outputDirectorysrc/main/resources/outputDirectory
/artifactItem
  /artifactItems
  silenttrue/silent
/configuration
  /execution

Since this is executed for every sub-module, everyone that inherits
from this master enterprise base parent (every Maven project in our
shop) will automatically get the most up to date, and corporate policy
adhering, configuration file. In your plugins which exploit these
configuration files, you can simply refer to
${basedir}/src/main/resources/com/acme/base/checkstyle.xml, e.g.

I think the only thing that I would change about this solution is that
having these things unpack during the generate-resources phase is a
bit too aggressive for our usage pattern. I could probably bring to
something closer to the install phase, but we then might lose the
ability to do clever things like mvn checkstyle:checkstyle directly...
Ideally, I could refer to a resource in a Spring-like manner, e.g.
classpath:com/acme/base/checkstyle.xml and then I wouldn't need any
unpack executions in the build at all!! Oooh, what a sweet dream
that would be.. :-) Anyhow, I have a half dozen of these
common-config-* modules and things are working out pretty smooth
otherwise.

Good luck!
-jesse

On Wed, Jan 21, 2009 at 4:01 AM, kukudas kukuda...@googlemail.com wrote:

 Thanks for the clearing Brian,

 i have read your tutorial and it seems a good approach, however i thought
 about an alternative aproach maybe you can give me your opinion about it.


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



Re: Maven inheritence works with 2.1-SNAPSHOT but not with 2.0.9

2009-01-21 Thread Brian E. Fox
This approach is ok too and sometimes required. Checkstyle can read its
config from the classpath so unpack isn't needed, but this isn't true for
all tools. In that case, dependency unpack is the best alternative.


On 1/21/09 7:47 AM, jie...@gmail.com jie...@gmail.com wrote:

 Just thought I would chime in with yet another alternative approach, I
 employ a solution slightly different than Brian's assembly solution.
 It is possibly not to be considered clean by the Maven crocodiles. :-)
 
 My top level enterprise parent pom has a few support modules
 immediately in its SCM hierarchy. Some of these modules are nothing
 more than configuration files, e.g. checkstyle.xml, stylesheet.css
 (for maven-javadoc-plugin), etc. They are default packagingjar and
 contain nothing but a src/main/resources/com/acme/base/filename.
 Then, in the enterprise parent pom I do something like:
 
 build
 plugins
   plugin
 artifactIdmaven-dependency-plugin/artifactId
 executions
   execution
 idExplode com.acme.base:common-config-checkstyle/id
 phasegenerate-resources/phase
 goals
   goalunpack/goal
 /goals
 configuration
   artifactItems
 artifactItem
   groupIdcom.acme.base/groupId
   artifactIdcommon-config-checkstyle/artifactId
   overWritefalse/overWrite
   outputDirectorysrc/main/resources/outputDirectory
 /artifactItem
   /artifactItems
   silenttrue/silent
 /configuration
   /execution
 
 Since this is executed for every sub-module, everyone that inherits
 from this master enterprise base parent (every Maven project in our
 shop) will automatically get the most up to date, and corporate policy
 adhering, configuration file. In your plugins which exploit these
 configuration files, you can simply refer to
 ${basedir}/src/main/resources/com/acme/base/checkstyle.xml, e.g.
 
 I think the only thing that I would change about this solution is that
 having these things unpack during the generate-resources phase is a
 bit too aggressive for our usage pattern. I could probably bring to
 something closer to the install phase, but we then might lose the
 ability to do clever things like mvn checkstyle:checkstyle directly...
 Ideally, I could refer to a resource in a Spring-like manner, e.g.
 classpath:com/acme/base/checkstyle.xml and then I wouldn't need any
 unpack executions in the build at all!! Oooh, what a sweet dream
 that would be.. :-) Anyhow, I have a half dozen of these
 common-config-* modules and things are working out pretty smooth
 otherwise.
 
 Good luck!
 -jesse
 
 On Wed, Jan 21, 2009 at 4:01 AM, kukudas kukuda...@googlemail.com wrote:
 
 Thanks for the clearing Brian,
 
 i have read your tutorial and it seems a good approach, however i thought
 about an alternative aproach maybe you can give me your opinion about it.
 
 
 -
 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: Maven inheritence works with 2.1-SNAPSHOT but not with 2.0.9

2009-01-21 Thread monkeyden

Don't mean to interrupt but mine is using pom packaging and inheritance does
not work with 2.0.9.  Is this a known issue?

FYI - I'm basically using Michael Yuan's seam parent example located here:
http://www.michaelyuan.com/blog/2007/10/09/jboss-seam-project-setup-with-maven-%E2%80%94-part-2-ear-deployment/
http://www.michaelyuan.com/blog/2007/10/09/jboss-seam-project-setup-with-maven-%E2%80%94-part-2-ear-deployment/
 

With the parent element in *my* main pom being:
parent
 groupIdorg.jboss.seam/groupId
 artifactIdroot/artifactId
 version2.1.1.GA/version
/parent

Would this create an issue?

Thanks


Brian E Fox wrote:
 
 You found a bug in 2.1-SNAPSHOT. The parents must be pom packaging types.
 
 If you want to share checkstyle, just bundle it into a jar with assembly,
 and then you can add that jar as a dependency to your checkstyle config.
 You
 don't need to inherit from the checkstyle jar itself, Checkstyle will find
 the xml on the classpath. I wrote some examples about this here:
 http://blogs.sonatype.com/people/2008/04/how-to-share-resources-across-proje
 cts-in-maven/
 
 http://blogs.sonatype.com/people/2008/04/how-to-override-a-plugins-dependenc
 y-in-maven/
 
 --Brian 
 
 On 1/20/09 8:03 AM, kukudas kukuda...@googlemail.com wrote:
 
 Hi,
 
 i have a problem and i hope somebody can help me. I'm kinda new to this
 things so maybe my approach is generaly wrong.
 
 i'm having a parent for example like this:
 
 modelVersion4.0.0/modelVersion
 groupIdorg.test/groupId
 artifactIdparent/artifactId
 version1/version
 build
 plugin
 groupIdorg.apache.maven.plugins/groupId
 artifactIdmaven-checkstyle-plugin/artifactId
 dependencies
 dependency
 groupId${pom.parent.groupId}/groupId
 artifactId${pom.parent.artifactId}/artifactId
 version${pom.parent.version}/version
 /dependency
 /dependencies
 /plugin
 reporting
 plugin
 groupIdorg.apache.maven.plugins/groupId
 artifactIdmaven-checkstyle-plugin/artifactId
 configuration
 configLocationcheckstyle.xml/configLocation
 /configuration
 /plugin
 /plugins
 /reporting
 /project
 
 And a child like this:
 
 parent
 groupIdorg.test/groupId
 artifactIdparent/artifactId
 version1/version
 /parent
 
 modelVersion4.0.0/modelVersion
 groupIdorg.test/groupId
 artifactIdchild/artifactId
 
 When i use Maven 2.0.9 i get the error that parent packaging has to be
 pom.
 But it has to be jar so my child can access the checkstyle.xml which is
 in
 the parent projects resource folder.
 With Maven 2.1-SNAPSHOT it works as expected (checkstyle runs with my
 rules
 which are in the parents resource folder). Is there maybe a better way to
 solve this or somehow make it work with both versions? I don't want to
 use
 packaging jar, run clean install for my parent and then change it to pom
 so
 that it will work with 2.0.9.
 
 
 Thanks in advance
 
 kukudas
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
 For additional commands, e-mail: users-h...@maven.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Maven-inheritence-works-with-2.1-SNAPSHOT-but-not-with-2.0.9-tp21562721p21598594.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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



Maven inheritence works with 2.1-SNAPSHOT but not with 2.0.9

2009-01-20 Thread kukudas
Hi,

i have a problem and i hope somebody can help me. I'm kinda new to this
things so maybe my approach is generaly wrong.

i'm having a parent for example like this:

modelVersion4.0.0/modelVersion
groupIdorg.test/groupId
artifactIdparent/artifactId
version1/version
build
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-checkstyle-plugin/artifactId
dependencies
dependency
groupId${pom.parent.groupId}/groupId
artifactId${pom.parent.artifactId}/artifactId
version${pom.parent.version}/version
/dependency
/dependencies
/plugin
reporting
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-checkstyle-plugin/artifactId
configuration
configLocationcheckstyle.xml/configLocation
/configuration
/plugin
/plugins
/reporting
/project

And a child like this:

parent
groupIdorg.test/groupId
artifactIdparent/artifactId
version1/version
/parent

modelVersion4.0.0/modelVersion
groupIdorg.test/groupId
artifactIdchild/artifactId

When i use Maven 2.0.9 i get the error that parent packaging has to be pom.
But it has to be jar so my child can access the checkstyle.xml which is in
the parent projects resource folder.
With Maven 2.1-SNAPSHOT it works as expected (checkstyle runs with my rules
which are in the parents resource folder). Is there maybe a better way to
solve this or somehow make it work with both versions? I don't want to use
packaging jar, run clean install for my parent and then change it to pom so
that it will work with 2.0.9.


Thanks in advance

kukudas


Re: Maven inheritence works with 2.1-SNAPSHOT but not with 2.0.9

2009-01-20 Thread Brian E. Fox
You found a bug in 2.1-SNAPSHOT. The parents must be pom packaging types.

If you want to share checkstyle, just bundle it into a jar with assembly,
and then you can add that jar as a dependency to your checkstyle config. You
don't need to inherit from the checkstyle jar itself, Checkstyle will find
the xml on the classpath. I wrote some examples about this here:
http://blogs.sonatype.com/people/2008/04/how-to-share-resources-across-proje
cts-in-maven/

http://blogs.sonatype.com/people/2008/04/how-to-override-a-plugins-dependenc
y-in-maven/

--Brian 

On 1/20/09 8:03 AM, kukudas kukuda...@googlemail.com wrote:

 Hi,
 
 i have a problem and i hope somebody can help me. I'm kinda new to this
 things so maybe my approach is generaly wrong.
 
 i'm having a parent for example like this:
 
 modelVersion4.0.0/modelVersion
 groupIdorg.test/groupId
 artifactIdparent/artifactId
 version1/version
 build
 plugin
 groupIdorg.apache.maven.plugins/groupId
 artifactIdmaven-checkstyle-plugin/artifactId
 dependencies
 dependency
 groupId${pom.parent.groupId}/groupId
 artifactId${pom.parent.artifactId}/artifactId
 version${pom.parent.version}/version
 /dependency
 /dependencies
 /plugin
 reporting
 plugin
 groupIdorg.apache.maven.plugins/groupId
 artifactIdmaven-checkstyle-plugin/artifactId
 configuration
 configLocationcheckstyle.xml/configLocation
 /configuration
 /plugin
 /plugins
 /reporting
 /project
 
 And a child like this:
 
 parent
 groupIdorg.test/groupId
 artifactIdparent/artifactId
 version1/version
 /parent
 
 modelVersion4.0.0/modelVersion
 groupIdorg.test/groupId
 artifactIdchild/artifactId
 
 When i use Maven 2.0.9 i get the error that parent packaging has to be pom.
 But it has to be jar so my child can access the checkstyle.xml which is in
 the parent projects resource folder.
 With Maven 2.1-SNAPSHOT it works as expected (checkstyle runs with my rules
 which are in the parents resource folder). Is there maybe a better way to
 solve this or somehow make it work with both versions? I don't want to use
 packaging jar, run clean install for my parent and then change it to pom so
 that it will work with 2.0.9.
 
 
 Thanks in advance
 
 kukudas


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