You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Farrukh Najmi <fa...@wellfleetsoftware.com> on 2007/08/20 17:53:35 UTC

Re: How to globally set version of dependencies used commonly in child poms

Maria Odea Ching wrote:
> Hi Farrukh,
>
> The version for the <parent> pom is required, so you can't remove that 
> from the child poms. Usually, you only change the version of your 
> project when you release it. The maven release plugin already updates 
> all the versions of the parent and child poms (in trunk) when it tags 
> the release so you wouldn't have to manually update each one of them.
Thanks Deng, Enrique, Arnaud and other colleagues for your help. What a 
great community this is.

So I understand that parent pom version MUST be specified in child poms 
and that the maven-release-plugin automates updating it.

On a related note what is the best practice for setting the version of 
commonly used dependencies throughout your child poms? I thought of 
setting properties in parent projects profiles.xml and using the prop 
reference in child poms. Does that seem like the best way? If not, what 
is suggested?

Note that I do not wish to declare the dependency in parent pom as I do 
not wish to inherit in all child poms.
I simply wish to set the versions in one place and reference them when I 
need it.

Thanks again.

-- 
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com



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


Re: How to globally set version of dependencies used commonly in child poms

Posted by David Hoffer <dh...@gmail.com>.
Maybe I'm not understanding the question but isn't depdendencyManagement
what they are looking for here?

-Dave


On Fri, Jun 6, 2014 at 6:23 AM, kadet666 <kr...@gmail.com>
wrote:

> Hi,
>
> I think
> mvn versions:set versions:update-child-modules
>
> is what you are looking for, it will update your parent and child poms
> versions in one go.
>
> Best Regards.
>
>
>
> -----
> Best Regards
>
> Krzysztof Dziadek
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/How-to-avoid-hardcoding-parent-pom-version-in-child-poms-tp92413p5794975.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: How to globally set version of dependencies used commonly in child poms

Posted by kadet666 <kr...@gmail.com>.
Hi, 

I think 
mvn versions:set versions:update-child-modules

is what you are looking for, it will update your parent and child poms
versions in one go. 

Best Regards. 



-----
Best Regards 

Krzysztof Dziadek
--
View this message in context: http://maven.40175.n5.nabble.com/How-to-avoid-hardcoding-parent-pom-version-in-child-poms-tp92413p5794975.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: How to globally set version of dependencies used commonly in child poms

Posted by John Quinn <qu...@gmail.com>.
Why can't you just use the exclusions tag under the child dependency tag(s)
in question?

This should exclude the child's excluded dependencies from being added to
the classpath.  Isn't that what you are trying to do?

John


On 8/20/07, Wayne Fay <wa...@gmail.com> wrote:
>
> Ultimately, you're still using this property substitution thing, which
> I think is screwing things up.
>
> Please try it with "properly declared" versions in the depMgmt
> section. If that works, then you know you're simply having troubles
> with the property substitution. If it doesn't work, then you've got
> other problems. Or if you're into TDD: make it green, then make it
> red, then play until its green again, etc.
>
> Also, as others have mentioned, you might want to look at
> pluginManagement as well.
>
> Wayne
>
> On 8/20/07, Farrukh Najmi <fa...@wellfleetsoftware.com> wrote:
> > Farrukh Najmi wrote:
> > > Thank you Wayne! I had completely missed this subtle but important
> > > distinction between <dependencies> and <dependencyManagement>..
> > >
> > > So I tried this out. It seems to work but not for dependencies that
> > > are plugin dependencies in child poms.
> > >
> > > In my parent pom I specified....
> > >
> > >    <dependencyManagement>
> > >        <dependencies>
> > >
> > > ....                     <dependency>
> > >                <groupId>com.sun.xml.ws</groupId>
> > >                <artifactId>jaxws-rt</artifactId>
> > >                <version>${jaxws.version}</version>
> > >            </dependency>
> > >            <dependency>
> > >                <groupId>com.sun.xml.ws</groupId>
> > >                <artifactId>jaxws-tools</artifactId>
> > >                <version>${jaxws.version}</version>
> > >            </dependency>                        </dependencies>
> > >    </dependencyManagement>
> > >
> > >    <properties>
> > >        <jaxws.version>2.1.3-SNAPSHOT</jaxws.version>
> > >    </properties>
> > >
> > > Then in my child pom I specified:
> > >
> > >    <build>
> > >        <plugins>
> > >            <plugin>
> > >                <groupId>org.codehaus.mojo</groupId>
> > >                <artifactId>jaxws-maven-plugin</artifactId>
> > >                <executions>
> > >                    <execution>
> > >                        <goals>
> > >                            <goal>wsimport</goal>
> > >                        </goals>
> > >                    </execution>
> > >                </executions>
> > >                <configuration>
> > >                       ....
> > >                </configuration>
> > >                <dependencies>
> > >                    <dependency>
> > >                        <groupId>com.sun.xml.ws</groupId>
> > >                        <artifactId>jaxws-tools</artifactId>
> > >                    </dependency>
> > >                    <dependency>
> > >                        <groupId>com.sun.xml.ws</groupId>
> > >                        <artifactId>jaxws-rt</artifactId>
> > >                    </dependency>
> > >
> > >                     ....
> </dependencies>
> > >            </plugin>
> > >                           </plugins>                  </build>
> > >
> > > With this I got the following error:
> > >
> > > [ERROR]FATAL ERROR
> > >
> >
> [INFO]------------------------------------------------------------------------
> > >
> > > [INFO]An invalid artifact was detected.
> > > [INFO]
> > > [INFO]This artifact might be in your project's POM, or it might have
> > > been included transitively during the resolution process. Here is the
> > > information we do have for this artifact:
> > > [INFO]
> > > [INFO]    o GroupID:     com.sun.xml.ws
> > > [INFO]    o ArtifactID:  jaxws-tools
> > > [INFO]    o Version:     <<< MISSING >>>
> > > [INFO]    o Type:        jar
> > >
> >
> [INFO]------------------------------------------------------------------------
> > >
> > > [DEBUG]Trace
> > > org.apache.maven.artifact.InvalidArtifactRTException: For artifact
> > > {com.sun.xml.ws:jaxws-tools:null:jar}: The version cannot be empty.
> > >        at
> > >
> > org.apache.maven.artifact.DefaultArtifact.validateIdentity(
> DefaultArtifact.java:144)
> > >
> > >        at
> > > org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java
> :119)
> > >
> > >        at
> > >
> > org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(
> DefaultArtifactFactory.java:155)
> > >
> > >        at
> > >
> >
> org.apache.maven.artifact.factory.DefaultArtifactFactory.createDependencyArtifact
> (DefaultArtifactFactory.java:67)
> > >
> > >        at
> > >
> > org.apache.maven.project.artifact.MavenMetadataSource.createArtifacts(
> MavenMetadataSource.java:330)
> > >
> > >        at
> > >
> > org.apache.maven.plugin.DefaultPluginManager.addPlugin(
> DefaultPluginManager.java:316)
> > >
> > >        at
> > >
> > org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(
> DefaultPluginManager.java:198)
> > >
> > >        at
> > >
> > org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(
> DefaultPluginManager.java:163)
> > >
> > >        at
> > >
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(
> DefaultLifecycleExecutor.java:1328)
> > >
> > >        at
> > >
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifecycle(
> DefaultLifecycleExecutor.java:1292)
> > >
> > >        at
> > >
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings
> (DefaultLifecycleExecutor.java:1058)
> > >
> > >        at
> > >
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
> DefaultLifecycleExecutor.java:529)
> > >
> > >        at
> > >
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
> (DefaultLifecycleExecutor.java:309)
> > >
> > >        at
> > >
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
> DefaultLifecycleExecutor.java:276)
> > >
> > >        at
> > >
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
> DefaultLifecycleExecutor.java:143)
> > >
> > >        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java
> :393)
> > >        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:182)
> > >        at
> > > org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java
> :760)
> > >        at
> > >
> > org.codehaus.mevenide.netbeans.execute.MavenJavaExecutor.run(
> MavenJavaExecutor.java:257)
> > >
> > >        at
> > > org.netbeans.core.execution.RunClassThread.run(RunClassThread.java
> :131)
> > >
> > > It seems the problem is only for plugin dependencies and not project
> > > dependencies.
> > > What am I doing wrong now? Thanks very much for your help.
> > >
> >
> > It getting even worse as I get to building projects that depend upon my
> > child pom.
> >
> > It seems that because I am missing version tag on dependencies in my
> > child pom,
> > if another project depends upon the child pom's project then I get
> > errors like:
> >
> >
> > [WARN]POM for 'my.child.project:pom:4.0-SNAPSHOT:compile' is invalid. It
> > will be ignored for artifact resolution. Reason: Failed to validate POM
> > [DEBUG]Reason: Failed to validate POM
> > [DEBUG]
> > [DEBUG]Validation Errors:
> > [DEBUG]'dependencies.dependency.version' is missing for junit:junit
> > [DEBUG]'dependencies.dependency.version' is missing for
> javax.xml:jaxr-api
> > [DEBUG]'dependencies.dependency.version' is missing for
> > com.sun.xml.ws:jaxws-rt
> > [DEBUG]'dependencies.dependency.version' is missing for
> > com.sun.xml.ws:jaxws-tools
> >
> > Indeed the versions are missing in that pom because they are specified
> > in the parent pom's dependencyManagent section.
> >
> > Above problem results in losing transitive dependencies from the pom
> > that was ignored due to above error.
> > The result is a compilation error :-(
> >
> > I must say that I am not a maven newbie, I am an experienced developer,
> > I have RTFM by now several times and I am still finding this maven
> > dependency stuff quite difficult to grok as to what is the expected
> > behavior and how to make things work for what seems to be a common use
> case.
> >
> > Thanks for any help on my latest problem above.
> >
> > --
> > Regards,
> > Farrukh
> >
> > Web: http://www.wellfleetsoftware.com
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: How to globally set version of dependencies used commonly in child poms

Posted by Wayne Fay <wa...@gmail.com>.
Ultimately, you're still using this property substitution thing, which
I think is screwing things up.

Please try it with "properly declared" versions in the depMgmt
section. If that works, then you know you're simply having troubles
with the property substitution. If it doesn't work, then you've got
other problems. Or if you're into TDD: make it green, then make it
red, then play until its green again, etc.

Also, as others have mentioned, you might want to look at
pluginManagement as well.

Wayne

On 8/20/07, Farrukh Najmi <fa...@wellfleetsoftware.com> wrote:
> Farrukh Najmi wrote:
> > Thank you Wayne! I had completely missed this subtle but important
> > distinction between <dependencies> and <dependencyManagement>..
> >
> > So I tried this out. It seems to work but not for dependencies that
> > are plugin dependencies in child poms.
> >
> > In my parent pom I specified....
> >
> >    <dependencyManagement>
> >        <dependencies>
> >
> > ....                     <dependency>
> >                <groupId>com.sun.xml.ws</groupId>
> >                <artifactId>jaxws-rt</artifactId>
> >                <version>${jaxws.version}</version>
> >            </dependency>
> >            <dependency>
> >                <groupId>com.sun.xml.ws</groupId>
> >                <artifactId>jaxws-tools</artifactId>
> >                <version>${jaxws.version}</version>
> >            </dependency>                        </dependencies>
> >    </dependencyManagement>
> >
> >    <properties>
> >        <jaxws.version>2.1.3-SNAPSHOT</jaxws.version>
> >    </properties>
> >
> > Then in my child pom I specified:
> >
> >    <build>
> >        <plugins>
> >            <plugin>
> >                <groupId>org.codehaus.mojo</groupId>
> >                <artifactId>jaxws-maven-plugin</artifactId>
> >                <executions>
> >                    <execution>
> >                        <goals>
> >                            <goal>wsimport</goal>
> >                        </goals>
> >                    </execution>
> >                </executions>
> >                <configuration>
> >                       ....
> >                </configuration>
> >                <dependencies>
> >                    <dependency>
> >                        <groupId>com.sun.xml.ws</groupId>
> >                        <artifactId>jaxws-tools</artifactId>
> >                    </dependency>
> >                    <dependency>
> >                        <groupId>com.sun.xml.ws</groupId>
> >                        <artifactId>jaxws-rt</artifactId>
> >                    </dependency>
> >
> >                     ....                                 </dependencies>
> >            </plugin>
> >                           </plugins>                  </build>
> >
> > With this I got the following error:
> >
> > [ERROR]FATAL ERROR
> >
> [INFO]------------------------------------------------------------------------
> >
> > [INFO]An invalid artifact was detected.
> > [INFO]
> > [INFO]This artifact might be in your project's POM, or it might have
> > been included transitively during the resolution process. Here is the
> > information we do have for this artifact:
> > [INFO]
> > [INFO]    o GroupID:     com.sun.xml.ws
> > [INFO]    o ArtifactID:  jaxws-tools
> > [INFO]    o Version:     <<< MISSING >>>
> > [INFO]    o Type:        jar
> >
> [INFO]------------------------------------------------------------------------
> >
> > [DEBUG]Trace
> > org.apache.maven.artifact.InvalidArtifactRTException: For artifact
> > {com.sun.xml.ws:jaxws-tools:null:jar}: The version cannot be empty.
> >        at
> >
> org.apache.maven.artifact.DefaultArtifact.validateIdentity(DefaultArtifact.java:144)
> >
> >        at
> > org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java:119)
> >
> >        at
> >
> org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(DefaultArtifactFactory.java:155)
> >
> >        at
> >
> org.apache.maven.artifact.factory.DefaultArtifactFactory.createDependencyArtifact(DefaultArtifactFactory.java:67)
> >
> >        at
> >
> org.apache.maven.project.artifact.MavenMetadataSource.createArtifacts(MavenMetadataSource.java:330)
> >
> >        at
> >
> org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.java:316)
> >
> >        at
> >
> org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:198)
> >
> >        at
> >
> org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:163)
> >
> >        at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1328)
> >
> >        at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifecycle(DefaultLifecycleExecutor.java:1292)
> >
> >        at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:1058)
> >
> >        at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:529)
> >
> >        at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:309)
> >
> >        at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:276)
> >
> >        at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
> >
> >        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:393)
> >        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:182)
> >        at
> > org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:760)
> >        at
> >
> org.codehaus.mevenide.netbeans.execute.MavenJavaExecutor.run(MavenJavaExecutor.java:257)
> >
> >        at
> > org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:131)
> >
> > It seems the problem is only for plugin dependencies and not project
> > dependencies.
> > What am I doing wrong now? Thanks very much for your help.
> >
>
> It getting even worse as I get to building projects that depend upon my
> child pom.
>
> It seems that because I am missing version tag on dependencies in my
> child pom,
> if another project depends upon the child pom's project then I get
> errors like:
>
>
> [WARN]POM for 'my.child.project:pom:4.0-SNAPSHOT:compile' is invalid. It
> will be ignored for artifact resolution. Reason: Failed to validate POM
> [DEBUG]Reason: Failed to validate POM
> [DEBUG]
> [DEBUG]Validation Errors:
> [DEBUG]'dependencies.dependency.version' is missing for junit:junit
> [DEBUG]'dependencies.dependency.version' is missing for javax.xml:jaxr-api
> [DEBUG]'dependencies.dependency.version' is missing for
> com.sun.xml.ws:jaxws-rt
> [DEBUG]'dependencies.dependency.version' is missing for
> com.sun.xml.ws:jaxws-tools
>
> Indeed the versions are missing in that pom because they are specified
> in the parent pom's dependencyManagent section.
>
> Above problem results in losing transitive dependencies from the pom
> that was ignored due to above error.
> The result is a compilation error :-(
>
> I must say that I am not a maven newbie, I am an experienced developer,
> I have RTFM by now several times and I am still finding this maven
> dependency stuff quite difficult to grok as to what is the expected
> behavior and how to make things work for what seems to be a common use case.
>
> Thanks for any help on my latest problem above.
>
> --
> Regards,
> Farrukh
>
> Web: http://www.wellfleetsoftware.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: How to globally set version of dependencies used commonly in child poms

Posted by Farrukh Najmi <fa...@wellfleetsoftware.com>.
Farrukh Najmi wrote:
> Thank you Wayne! I had completely missed this subtle but important 
> distinction between <dependencies> and <dependencyManagement>..
>
> So I tried this out. It seems to work but not for dependencies that 
> are plugin dependencies in child poms.
>
> In my parent pom I specified....
>
>    <dependencyManagement>
>        <dependencies>
>
> ....                     <dependency>
>                <groupId>com.sun.xml.ws</groupId>
>                <artifactId>jaxws-rt</artifactId>
>                <version>${jaxws.version}</version>
>            </dependency>
>            <dependency>
>                <groupId>com.sun.xml.ws</groupId>
>                <artifactId>jaxws-tools</artifactId>
>                <version>${jaxws.version}</version>
>            </dependency>                        </dependencies>
>    </dependencyManagement>
>
>    <properties>
>        <jaxws.version>2.1.3-SNAPSHOT</jaxws.version>
>    </properties>
>
> Then in my child pom I specified:
>
>    <build>
>        <plugins>
>            <plugin>
>                <groupId>org.codehaus.mojo</groupId>
>                <artifactId>jaxws-maven-plugin</artifactId>
>                <executions>
>                    <execution>
>                        <goals>
>                            <goal>wsimport</goal>
>                        </goals>
>                    </execution>
>                </executions>
>                <configuration>
>                       ....
>                </configuration>
>                <dependencies>
>                    <dependency>
>                        <groupId>com.sun.xml.ws</groupId>
>                        <artifactId>jaxws-tools</artifactId>
>                    </dependency>
>                    <dependency>
>                        <groupId>com.sun.xml.ws</groupId>
>                        <artifactId>jaxws-rt</artifactId>
>                    </dependency>
>
>                     ....                                 </dependencies>
>            </plugin>
>                           </plugins>                  </build>
>
> With this I got the following error:
>
> [ERROR]FATAL ERROR
> [INFO]------------------------------------------------------------------------ 
>
> [INFO]An invalid artifact was detected.
> [INFO]
> [INFO]This artifact might be in your project's POM, or it might have 
> been included transitively during the resolution process. Here is the 
> information we do have for this artifact:
> [INFO]
> [INFO]    o GroupID:     com.sun.xml.ws
> [INFO]    o ArtifactID:  jaxws-tools
> [INFO]    o Version:     <<< MISSING >>>
> [INFO]    o Type:        jar
> [INFO]------------------------------------------------------------------------ 
>
> [DEBUG]Trace
> org.apache.maven.artifact.InvalidArtifactRTException: For artifact 
> {com.sun.xml.ws:jaxws-tools:null:jar}: The version cannot be empty.
>        at 
> org.apache.maven.artifact.DefaultArtifact.validateIdentity(DefaultArtifact.java:144) 
>
>        at 
> org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java:119) 
>
>        at 
> org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(DefaultArtifactFactory.java:155) 
>
>        at 
> org.apache.maven.artifact.factory.DefaultArtifactFactory.createDependencyArtifact(DefaultArtifactFactory.java:67) 
>
>        at 
> org.apache.maven.project.artifact.MavenMetadataSource.createArtifacts(MavenMetadataSource.java:330) 
>
>        at 
> org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.java:316) 
>
>        at 
> org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:198) 
>
>        at 
> org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:163) 
>
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1328) 
>
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifecycle(DefaultLifecycleExecutor.java:1292) 
>
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:1058) 
>
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:529) 
>
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:309) 
>
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:276) 
>
>        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143) 
>
>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:393)
>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:182)
>        at 
> org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:760)
>        at 
> org.codehaus.mevenide.netbeans.execute.MavenJavaExecutor.run(MavenJavaExecutor.java:257) 
>
>        at 
> org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:131)
>
> It seems the problem is only for plugin dependencies and not project 
> dependencies.
> What am I doing wrong now? Thanks very much for your help.
>

It getting even worse as I get to building projects that depend upon my 
child pom.

It seems that because I am missing version tag on dependencies in my 
child pom,
if another project depends upon the child pom's project then I get 
errors like:


[WARN]POM for 'my.child.project:pom:4.0-SNAPSHOT:compile' is invalid. It 
will be ignored for artifact resolution. Reason: Failed to validate POM
[DEBUG]Reason: Failed to validate POM
[DEBUG]
[DEBUG]Validation Errors:
[DEBUG]'dependencies.dependency.version' is missing for junit:junit
[DEBUG]'dependencies.dependency.version' is missing for javax.xml:jaxr-api
[DEBUG]'dependencies.dependency.version' is missing for 
com.sun.xml.ws:jaxws-rt
[DEBUG]'dependencies.dependency.version' is missing for 
com.sun.xml.ws:jaxws-tools

Indeed the versions are missing in that pom because they are specified 
in the parent pom's dependencyManagent section.

Above problem results in losing transitive dependencies from the pom 
that was ignored due to above error.
The result is a compilation error :-(

I must say that I am not a maven newbie, I am an experienced developer, 
I have RTFM by now several times and I am still finding this maven 
dependency stuff quite difficult to grok as to what is the expected 
behavior and how to make things work for what seems to be a common use case.

Thanks for any help on my latest problem above.

-- 
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com



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


Re: How to globally set version of dependencies used commonly in child poms

Posted by programr <ma...@ambientideas.com>.
You also need to look at <pluginManagement> for the same effect for plugins.

http://maven.apache.org/pom.html#Plugin%20Management

-Matthew McCullough
Ambient Ideas, LLC
matthewm@ambientideas.com



Farrukh Najmi-2 wrote:
> 
> Thank you Wayne! I had completely missed this subtle but important 
> distinction between <dependencies> and <dependencyManagement>..
> 
> So I tried this out. It seems to work but not for dependencies that are 
> plugin dependencies in child poms.
> 
> In my parent pom I specified....
> 
>     <dependencyManagement>
>         <dependencies>
> 
> ....          
>             <dependency>
>                 <groupId>com.sun.xml.ws</groupId>
>                 <artifactId>jaxws-rt</artifactId>
>                 <version>${jaxws.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>com.sun.xml.ws</groupId>
>                 <artifactId>jaxws-tools</artifactId>
>                 <version>${jaxws.version}</version>
>             </dependency>       
>            
>         </dependencies>
>     </dependencyManagement>
> 
>     <properties>
>         <jaxws.version>2.1.3-SNAPSHOT</jaxws.version>
>     </properties>
> 
> Then in my child pom I specified:
> 
>     <build>
>         <plugins>
>             <plugin>
>                 <groupId>org.codehaus.mojo</groupId>
>                 <artifactId>jaxws-maven-plugin</artifactId>
>                 <executions>
>                     <execution>
>                         <goals>
>                             <goal>wsimport</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>                 <configuration>
>                        ....
>                 </configuration>
>                 <dependencies>
>                     <dependency>
>                         <groupId>com.sun.xml.ws</groupId>
>                         <artifactId>jaxws-tools</artifactId>
>                     </dependency>
>                     <dependency>
>                         <groupId>com.sun.xml.ws</groupId>
>                         <artifactId>jaxws-rt</artifactId>
>                     </dependency>
> 
>                      ....                  
>                 </dependencies>
>             </plugin>
>            
>           
>         </plugins>               
>     </build>
> 
> With this I got the following error:
> 
> [ERROR]FATAL ERROR
> [INFO]------------------------------------------------------------------------
> [INFO]An invalid artifact was detected.
> [INFO]
> [INFO]This artifact might be in your project's POM, or it might have 
> been included transitively during the resolution process. Here is the 
> information we do have for this artifact:
> [INFO]
> [INFO]    o GroupID:     com.sun.xml.ws
> [INFO]    o ArtifactID:  jaxws-tools
> [INFO]    o Version:     <<< MISSING >>>
> [INFO]    o Type:        jar
> [INFO]------------------------------------------------------------------------
> [DEBUG]Trace
> org.apache.maven.artifact.InvalidArtifactRTException: For artifact 
> {com.sun.xml.ws:jaxws-tools:null:jar}: The version cannot be empty.
>         at 
> org.apache.maven.artifact.DefaultArtifact.validateIdentity(DefaultArtifact.java:144)
>         at 
> org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java:119)
>         at 
> org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(DefaultArtifactFactory.java:155)
>         at 
> org.apache.maven.artifact.factory.DefaultArtifactFactory.createDependencyArtifact(DefaultArtifactFactory.java:67)
>         at 
> org.apache.maven.project.artifact.MavenMetadataSource.createArtifacts(MavenMetadataSource.java:330)
>         at 
> org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.java:316)
>         at 
> org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:198)
>         at 
> org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:163)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1328)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifecycle(DefaultLifecycleExecutor.java:1292)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:1058)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:529)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:309)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:276)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:393)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:182)
>         at 
> org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:760)
>         at 
> org.codehaus.mevenide.netbeans.execute.MavenJavaExecutor.run(MavenJavaExecutor.java:257)
>         at 
> org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:131)
> 
> It seems the problem is only for plugin dependencies and not project 
> dependencies.
> What am I doing wrong now? Thanks very much for your help.
> 
> -- 
> Regards,
> Farrukh
> 
> Web: http://www.wellfleetsoftware.com
> 
> 
> 
> Wayne Fay wrote:
>> This is what I thought. You are simply using dependencies, not
>> dependencyManagement... depMgmt is a completely separate xml node in
>> the pom.xml file.
>>
>> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-avoid-hardcoding-parent-pom-version-in-child-poms--tf4299480s177.html#a12240894
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: How to globally set version of dependencies used commonly in child poms

Posted by Farhan Sarwar <fa...@gmail.com>.
Farrukh,

I think you'll require using the pluginManagement tag in the parent
pom to achieve the same behaviour for plugins.

Farhan.

On 8/20/07, Farrukh Najmi <fa...@wellfleetsoftware.com> wrote:
> Thank you Wayne! I had completely missed this subtle but important
> distinction between <dependencies> and <dependencyManagement>..
>
> So I tried this out. It seems to work but not for dependencies that are
> plugin dependencies in child poms.
>
> In my parent pom I specified....
>
>    <dependencyManagement>
>        <dependencies>
>
> ....
>            <dependency>
>                <groupId>com.sun.xml.ws</groupId>
>                <artifactId>jaxws-rt</artifactId>
>                <version>${jaxws.version}</version>
>            </dependency>
>            <dependency>
>                <groupId>com.sun.xml.ws</groupId>
>                <artifactId>jaxws-tools</artifactId>
>                <version>${jaxws.version}</version>
>            </dependency>
>
>        </dependencies>
>    </dependencyManagement>
>
>    <properties>
>        <jaxws.version>2.1.3-SNAPSHOT</jaxws.version>
>    </properties>
>
> Then in my child pom I specified:
>
>    <build>
>        <plugins>
>            <plugin>
>                <groupId>org.codehaus.mojo</groupId>
>                <artifactId>jaxws-maven-plugin</artifactId>
>                <executions>
>                    <execution>
>                        <goals>
>                            <goal>wsimport</goal>
>                        </goals>
>                    </execution>
>                </executions>
>                <configuration>
>                       ....
>                </configuration>
>                <dependencies>
>                    <dependency>
>                        <groupId>com.sun.xml.ws</groupId>
>                        <artifactId>jaxws-tools</artifactId>
>                    </dependency>
>                    <dependency>
>                        <groupId>com.sun.xml.ws</groupId>
>                        <artifactId>jaxws-rt</artifactId>
>                    </dependency>
>
>                     ....
>                </dependencies>
>            </plugin>
>
>
>        </plugins>
>    </build>
>
> With this I got the following error:
>
> [ERROR]FATAL ERROR
> [INFO]------------------------------------------------------------------------
> [INFO]An invalid artifact was detected.
> [INFO]
> [INFO]This artifact might be in your project's POM, or it might have
> been included transitively during the resolution process. Here is the
> information we do have for this artifact:
> [INFO]
> [INFO]    o GroupID:     com.sun.xml.ws
> [INFO]    o ArtifactID:  jaxws-tools
> [INFO]    o Version:     <<< MISSING >>>
> [INFO]    o Type:        jar
> [INFO]------------------------------------------------------------------------
> [DEBUG]Trace
> org.apache.maven.artifact.InvalidArtifactRTException: For artifact
> {com.sun.xml.ws:jaxws-tools:null:jar}: The version cannot be empty.
>        at
> org.apache.maven.artifact.DefaultArtifact.validateIdentity(DefaultArtifact.java:144)
>        at
> org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java:119)
>        at
> org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(DefaultArtifactFactory.java:155)
>        at
> org.apache.maven.artifact.factory.DefaultArtifactFactory.createDependencyArtifact(DefaultArtifactFactory.java:67)
>        at
> org.apache.maven.project.artifact.MavenMetadataSource.createArtifacts(MavenMetadataSource.java:330)
>        at
> org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.java:316)
>        at
> org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:198)
>        at
> org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:163)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1328)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifecycle(DefaultLifecycleExecutor.java:1292)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:1058)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:529)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:309)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:276)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:393)
>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:182)
>        at
> org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:760)
>        at
> org.codehaus.mevenide.netbeans.execute.MavenJavaExecutor.run(MavenJavaExecutor.java:257)
>        at
> org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:131)
>
> It seems the problem is only for plugin dependencies and not project
> dependencies.
> What am I doing wrong now? Thanks very much for your help.
>
> --
> Regards,
> Farrukh
>
> Web: http://www.wellfleetsoftware.com
>
>
>
> Wayne Fay wrote:
> > This is what I thought. You are simply using dependencies, not
> > dependencyManagement... depMgmt is a completely separate xml node in
> > the pom.xml file.
> >
> > http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: How to globally set version of dependencies used commonly in child poms

Posted by Farrukh Najmi <fa...@wellfleetsoftware.com>.
Thank you Wayne! I had completely missed this subtle but important 
distinction between <dependencies> and <dependencyManagement>..

So I tried this out. It seems to work but not for dependencies that are 
plugin dependencies in child poms.

In my parent pom I specified....

    <dependencyManagement>
        <dependencies>

....          
            <dependency>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>jaxws-rt</artifactId>
                <version>${jaxws.version}</version>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>jaxws-tools</artifactId>
                <version>${jaxws.version}</version>
            </dependency>       
           
        </dependencies>
    </dependencyManagement>

    <properties>
        <jaxws.version>2.1.3-SNAPSHOT</jaxws.version>
    </properties>

Then in my child pom I specified:

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                       ....
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.sun.xml.ws</groupId>
                        <artifactId>jaxws-tools</artifactId>
                    </dependency>
                    <dependency>
                        <groupId>com.sun.xml.ws</groupId>
                        <artifactId>jaxws-rt</artifactId>
                    </dependency>

                     ....                  
                </dependencies>
            </plugin>
           
          
        </plugins>               
    </build>

With this I got the following error:

[ERROR]FATAL ERROR
[INFO]------------------------------------------------------------------------
[INFO]An invalid artifact was detected.
[INFO]
[INFO]This artifact might be in your project's POM, or it might have 
been included transitively during the resolution process. Here is the 
information we do have for this artifact:
[INFO]
[INFO]    o GroupID:     com.sun.xml.ws
[INFO]    o ArtifactID:  jaxws-tools
[INFO]    o Version:     <<< MISSING >>>
[INFO]    o Type:        jar
[INFO]------------------------------------------------------------------------
[DEBUG]Trace
org.apache.maven.artifact.InvalidArtifactRTException: For artifact 
{com.sun.xml.ws:jaxws-tools:null:jar}: The version cannot be empty.
        at 
org.apache.maven.artifact.DefaultArtifact.validateIdentity(DefaultArtifact.java:144)
        at 
org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java:119)
        at 
org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(DefaultArtifactFactory.java:155)
        at 
org.apache.maven.artifact.factory.DefaultArtifactFactory.createDependencyArtifact(DefaultArtifactFactory.java:67)
        at 
org.apache.maven.project.artifact.MavenMetadataSource.createArtifacts(MavenMetadataSource.java:330)
        at 
org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.java:316)
        at 
org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:198)
        at 
org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:163)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1328)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifecycle(DefaultLifecycleExecutor.java:1292)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:1058)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:529)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:309)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:276)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:393)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:182)
        at 
org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:760)
        at 
org.codehaus.mevenide.netbeans.execute.MavenJavaExecutor.run(MavenJavaExecutor.java:257)
        at 
org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:131)

It seems the problem is only for plugin dependencies and not project 
dependencies.
What am I doing wrong now? Thanks very much for your help.

-- 
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com



Wayne Fay wrote:
> This is what I thought. You are simply using dependencies, not
> dependencyManagement... depMgmt is a completely separate xml node in
> the pom.xml file.
>
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
>   


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


Re: How to globally set version of dependencies used commonly in child poms

Posted by Wayne Fay <wa...@gmail.com>.
This is what I thought. You are simply using dependencies, not
dependencyManagement... depMgmt is a completely separate xml node in
the pom.xml file.

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

Wayne

On 8/20/07, Farrukh Najmi <fa...@wellfleetsoftware.com> wrote:
> Hi Wayne,
>
> I thought I understood dependency management but now I am not too sure.
>
> As I understood your suggestion, if I define a dependency with a version
> in top level pom
> then if child pom specifies the same project as a dependency without a
> version then maven will
> use the version specified in parent pom.
>
> I tried this out and this is not how it seems to work. For example I
> specified the following in parent pom:
>
>         <dependency>
>             <groupId>junit</groupId>
>             <artifactId>junit</artifactId>
>             <version>3.8.1</version>
>             <scope>test</scope>
>         </dependency>
>
> and then specified following in child pom:
>
>         <dependency>
>             <groupId>junit</groupId>
>             <artifactId>junit</artifactId>
>         </dependency>
>
> and I got the following error:
>
> [ERROR]FATAL ERROR
> [INFO]------------------------------------------------------------------------
> [INFO]Error building POM (may not be this project's POM).
> [INFO]
> [INFO]
> [INFO]Project ID: org.freebxml.omar:regrep-bindings
> [INFO]POM Location:
> /home/najmi/omar4/ebxmlrr/omar/trunk/regrep-bindings/pom.xml
> [INFO]Validation Messages:
> [INFO]
> [INFO]    [0]  'dependencies.dependency.version' is missing for junit:junit
>
> This is consistent with my old understanding of dep mgt. but not with
> the understanding I interpreted from
> your advice on this thread.
>
> Please clarify what I am doing wrong.
>
> Lastly, what is the definitive description for dependency management. I
> could really stand to read it in detail as you suggested. Thanks.
>
>
> Wayne Fay wrote:
> > The purpose of depMgmt is to set the dep versions in one place (the
> > top parent for a given project) and then where you need the dep, you
> > simply state the groupId, artifactId, and optionally scope and
> > classifier.
> >
> > So you shouldn't have depMgmt in children poms. For best use (IMO),
> > depMgmt should be consolidated in one declaration at the top parent.
> > Otherwise you are back in the situation of chasing down versions in
> > multiple poms which is exactly what depMgmt does for you.
> >
> > Also depMgmt does not suddenly enforce all those dependencies on the
> > parent pom. It merely serves as a placeholder for the version
> > information. If you want to add those deps in the parent, you are
> > welcome to do so, but they would be declared in normal <dependency>
> > nodes alongside the depMgmt node.
> >
> > I think you should go read a little more on dependencyManagement (and
> > do some tests yourself) before implementing this "version as property"
> > approach. I think you must be using depMgmt wrong.
> >
> > The mojo "mvn help:effective-pom" is a useful tool for exploring
> > issues like this.
> >
> > Wayne
> >
> > On 8/20/07, Farrukh Najmi <fa...@wellfleetsoftware.com> wrote:
> >
> >> Wayne Fay wrote:
> >>
> >>> You asked for the "best practice" -- the answer is
> >>> dependencyManagement. I just don't see any reason to use versions
> >>> defined in properties like this when you can easily use depMgmt.
> >>>
> >>>
> >> Sorry for asking the question incorrectly. I guess the question is:
> >>
> >> What is the best practive for setting a property in parent project so it
> >> can be referenced in
> >> any child project's pom.
> >>
> >> BTW I do not quite understand why you think what I am trying to do is an
> >> alternative to depMgmt.
> >> AFAIK, I *AM* using depMgmt, it's just the many jars are in depMgmt of
> >> many child poms and I do not
> >> want to set them as a parent pom dependency and do not want to hardcode
> >> their version in child poms either.
> >>
> >> Hence, the idea of using project-wide property.
> >>
> >> Sorry if I am missing something obvious that makes above idea not make
> >> sense.
> >>
>
>
>
> --
> Regards,
> Farrukh
>
> Web: http://www.wellfleetsoftware.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: How to globally set version of dependencies used commonly in child poms

Posted by Farrukh Najmi <fa...@wellfleetsoftware.com>.
Hi Wayne,

I thought I understood dependency management but now I am not too sure.

As I understood your suggestion, if I define a dependency with a version 
in top level pom
then if child pom specifies the same project as a dependency without a 
version then maven will
use the version specified in parent pom.

I tried this out and this is not how it seems to work. For example I 
specified the following in parent pom:

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

and then specified following in child pom:

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
       
and I got the following error:

[ERROR]FATAL ERROR
[INFO]------------------------------------------------------------------------
[INFO]Error building POM (may not be this project's POM).
[INFO]
[INFO]
[INFO]Project ID: org.freebxml.omar:regrep-bindings
[INFO]POM Location: 
/home/najmi/omar4/ebxmlrr/omar/trunk/regrep-bindings/pom.xml
[INFO]Validation Messages:
[INFO]
[INFO]    [0]  'dependencies.dependency.version' is missing for junit:junit

This is consistent with my old understanding of dep mgt. but not with 
the understanding I interpreted from
your advice on this thread.

Please clarify what I am doing wrong.

Lastly, what is the definitive description for dependency management. I 
could really stand to read it in detail as you suggested. Thanks.


Wayne Fay wrote:
> The purpose of depMgmt is to set the dep versions in one place (the
> top parent for a given project) and then where you need the dep, you
> simply state the groupId, artifactId, and optionally scope and
> classifier.
>
> So you shouldn't have depMgmt in children poms. For best use (IMO),
> depMgmt should be consolidated in one declaration at the top parent.
> Otherwise you are back in the situation of chasing down versions in
> multiple poms which is exactly what depMgmt does for you.
>
> Also depMgmt does not suddenly enforce all those dependencies on the
> parent pom. It merely serves as a placeholder for the version
> information. If you want to add those deps in the parent, you are
> welcome to do so, but they would be declared in normal <dependency>
> nodes alongside the depMgmt node.
>
> I think you should go read a little more on dependencyManagement (and
> do some tests yourself) before implementing this "version as property"
> approach. I think you must be using depMgmt wrong.
>
> The mojo "mvn help:effective-pom" is a useful tool for exploring
> issues like this.
>
> Wayne
>
> On 8/20/07, Farrukh Najmi <fa...@wellfleetsoftware.com> wrote:
>   
>> Wayne Fay wrote:
>>     
>>> You asked for the "best practice" -- the answer is
>>> dependencyManagement. I just don't see any reason to use versions
>>> defined in properties like this when you can easily use depMgmt.
>>>
>>>       
>> Sorry for asking the question incorrectly. I guess the question is:
>>
>> What is the best practive for setting a property in parent project so it
>> can be referenced in
>> any child project's pom.
>>
>> BTW I do not quite understand why you think what I am trying to do is an
>> alternative to depMgmt.
>> AFAIK, I *AM* using depMgmt, it's just the many jars are in depMgmt of
>> many child poms and I do not
>> want to set them as a parent pom dependency and do not want to hardcode
>> their version in child poms either.
>>
>> Hence, the idea of using project-wide property.
>>
>> Sorry if I am missing something obvious that makes above idea not make
>> sense.
>>     



-- 
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com



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


Re: How to globally set version of dependencies used commonly in child poms

Posted by Wayne Fay <wa...@gmail.com>.
The purpose of depMgmt is to set the dep versions in one place (the
top parent for a given project) and then where you need the dep, you
simply state the groupId, artifactId, and optionally scope and
classifier.

So you shouldn't have depMgmt in children poms. For best use (IMO),
depMgmt should be consolidated in one declaration at the top parent.
Otherwise you are back in the situation of chasing down versions in
multiple poms which is exactly what depMgmt does for you.

Also depMgmt does not suddenly enforce all those dependencies on the
parent pom. It merely serves as a placeholder for the version
information. If you want to add those deps in the parent, you are
welcome to do so, but they would be declared in normal <dependency>
nodes alongside the depMgmt node.

I think you should go read a little more on dependencyManagement (and
do some tests yourself) before implementing this "version as property"
approach. I think you must be using depMgmt wrong.

The mojo "mvn help:effective-pom" is a useful tool for exploring
issues like this.

Wayne

On 8/20/07, Farrukh Najmi <fa...@wellfleetsoftware.com> wrote:
> Wayne Fay wrote:
> > You asked for the "best practice" -- the answer is
> > dependencyManagement. I just don't see any reason to use versions
> > defined in properties like this when you can easily use depMgmt.
> >
>
> Sorry for asking the question incorrectly. I guess the question is:
>
> What is the best practive for setting a property in parent project so it
> can be referenced in
> any child project's pom.
>
> BTW I do not quite understand why you think what I am trying to do is an
> alternative to depMgmt.
> AFAIK, I *AM* using depMgmt, it's just the many jars are in depMgmt of
> many child poms and I do not
> want to set them as a parent pom dependency and do not want to hardcode
> their version in child poms either.
>
> Hence, the idea of using project-wide property.
>
> Sorry if I am missing something obvious that makes above idea not make
> sense.
> > Anyway, you could define your property in the top parent and then all
> > the children should inherit it. Or simply define those properties in
> > settings.xml in an activeByDefault profile if you want to use these
> > same properties across multiple projects.
> >
>
> Sorry to ask a basic question on how best to set a property in top parent.
> If I set in in top parent's profiles.xml would it be inherited by child
> poms?
>
> Thanks again for your terrific help.
>
> --
> Regards,
> Farrukh
>
> Web: http://www.wellfleetsoftware.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: How to globally set version of dependencies used commonly in child poms

Posted by Farrukh Najmi <fa...@wellfleetsoftware.com>.
Farrukh Najmi wrote:
> Sorry to ask a basic question on how best to set a property in top 
> parent.
> If I set in in top parent's profiles.xml would it be inherited by 
> child poms?
>
> Thanks again for your terrific help.
>

According to:

<http://maven.apache.org/pom.html#Properties>

The way to specify prop in pom is:

<properties>
  <propname>value</propname>
</properties>


Sorry to not have RTFM.

-- 
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com



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


Re: How to globally set version of dependencies used commonly in child poms

Posted by Farrukh Najmi <fa...@wellfleetsoftware.com>.
Wayne Fay wrote:
> You asked for the "best practice" -- the answer is
> dependencyManagement. I just don't see any reason to use versions
> defined in properties like this when you can easily use depMgmt.
>   

Sorry for asking the question incorrectly. I guess the question is:

What is the best practive for setting a property in parent project so it 
can be referenced in
any child project's pom.

BTW I do not quite understand why you think what I am trying to do is an 
alternative to depMgmt.
AFAIK, I *AM* using depMgmt, it's just the many jars are in depMgmt of 
many child poms and I do not
want to set them as a parent pom dependency and do not want to hardcode 
their version in child poms either.

Hence, the idea of using project-wide property.

Sorry if I am missing something obvious that makes above idea not make 
sense.
> Anyway, you could define your property in the top parent and then all
> the children should inherit it. Or simply define those properties in
> settings.xml in an activeByDefault profile if you want to use these
> same properties across multiple projects.
>   

Sorry to ask a basic question on how best to set a property in top parent.
If I set in in top parent's profiles.xml would it be inherited by child 
poms?

Thanks again for your terrific help.

-- 
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com



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


Re: How to globally set version of dependencies used commonly in child poms

Posted by Wayne Fay <wa...@gmail.com>.
You asked for the "best practice" -- the answer is
dependencyManagement. I just don't see any reason to use versions
defined in properties like this when you can easily use depMgmt.

Anyway, you could define your property in the top parent and then all
the children should inherit it. Or simply define those properties in
settings.xml in an activeByDefault profile if you want to use these
same properties across multiple projects.

Wayne

On 8/20/07, Farrukh Najmi <fa...@wellfleetsoftware.com> wrote:
>
> Hi Wayne,
>
> I understand dependency management for most part. I want my dependencies
> in child poms to use property refs like:
>
>         <dependency>
>             <groupId>com.sun.xml.ws</groupId>
>             <artifactId>jaxws-rt</artifactId>
>             <version>${jaxws.version}</version>
>         </dependency>
>
> instead of hardcoding version of jaxws jars everywhere in child poms
> that depend on them.
>
> So I am looking for a way to set these vars for an entire multi-project
> once and reference them in any child pom. Thanks.
>
> Wayne Fay wrote:
> > This is basically the definition of dependencyManagement. Take a look
> > at it, and add it to your parent pom.
> >
> > Wayne
> >
> > On 8/20/07, Farrukh Najmi <fa...@wellfleetsoftware.com> wrote:
> >
> >> Maria Odea Ching wrote:
> >>
> >>> Hi Farrukh,
> >>>
> >>> The version for the <parent> pom is required, so you can't remove that
> >>> from the child poms. Usually, you only change the version of your
> >>> project when you release it. The maven release plugin already updates
> >>> all the versions of the parent and child poms (in trunk) when it tags
> >>> the release so you wouldn't have to manually update each one of them.
> >>>
> >> Thanks Deng, Enrique, Arnaud and other colleagues for your help. What a
> >> great community this is.
> >>
> >> So I understand that parent pom version MUST be specified in child poms
> >> and that the maven-release-plugin automates updating it.
> >>
> >> On a related note what is the best practice for setting the version of
> >> commonly used dependencies throughout your child poms? I thought of
> >> setting properties in parent projects profiles.xml and using the prop
> >> reference in child poms. Does that seem like the best way? If not, what
> >> is suggested?
> >>
> >> Note that I do not wish to declare the dependency in parent pom as I do
> >> not wish to inherit in all child poms.
> >> I simply wish to set the versions in one place and reference them when I
> >> need it.
> >>
> >>
>
>
> --
> Regards,
> Farrukh
>
> Web: http://www.wellfleetsoftware.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: How to globally set version of dependencies used commonly in child poms

Posted by Farrukh Najmi <fa...@wellfleetsoftware.com>.
Hi Wayne,

I understand dependency management for most part. I want my dependencies 
in child poms to use property refs like:

        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>${jaxws.version}</version>
        </dependency>

instead of hardcoding version of jaxws jars everywhere in child poms 
that depend on them.

So I am looking for a way to set these vars for an entire multi-project 
once and reference them in any child pom. Thanks.

Wayne Fay wrote:
> This is basically the definition of dependencyManagement. Take a look
> at it, and add it to your parent pom.
>
> Wayne
>
> On 8/20/07, Farrukh Najmi <fa...@wellfleetsoftware.com> wrote:
>   
>> Maria Odea Ching wrote:
>>     
>>> Hi Farrukh,
>>>
>>> The version for the <parent> pom is required, so you can't remove that
>>> from the child poms. Usually, you only change the version of your
>>> project when you release it. The maven release plugin already updates
>>> all the versions of the parent and child poms (in trunk) when it tags
>>> the release so you wouldn't have to manually update each one of them.
>>>       
>> Thanks Deng, Enrique, Arnaud and other colleagues for your help. What a
>> great community this is.
>>
>> So I understand that parent pom version MUST be specified in child poms
>> and that the maven-release-plugin automates updating it.
>>
>> On a related note what is the best practice for setting the version of
>> commonly used dependencies throughout your child poms? I thought of
>> setting properties in parent projects profiles.xml and using the prop
>> reference in child poms. Does that seem like the best way? If not, what
>> is suggested?
>>
>> Note that I do not wish to declare the dependency in parent pom as I do
>> not wish to inherit in all child poms.
>> I simply wish to set the versions in one place and reference them when I
>> need it.
>>
>>     


-- 
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com



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


Re: How to globally set version of dependencies used commonly in child poms

Posted by Wayne Fay <wa...@gmail.com>.
This is basically the definition of dependencyManagement. Take a look
at it, and add it to your parent pom.

Wayne

On 8/20/07, Farrukh Najmi <fa...@wellfleetsoftware.com> wrote:
> Maria Odea Ching wrote:
> > Hi Farrukh,
> >
> > The version for the <parent> pom is required, so you can't remove that
> > from the child poms. Usually, you only change the version of your
> > project when you release it. The maven release plugin already updates
> > all the versions of the parent and child poms (in trunk) when it tags
> > the release so you wouldn't have to manually update each one of them.
> Thanks Deng, Enrique, Arnaud and other colleagues for your help. What a
> great community this is.
>
> So I understand that parent pom version MUST be specified in child poms
> and that the maven-release-plugin automates updating it.
>
> On a related note what is the best practice for setting the version of
> commonly used dependencies throughout your child poms? I thought of
> setting properties in parent projects profiles.xml and using the prop
> reference in child poms. Does that seem like the best way? If not, what
> is suggested?
>
> Note that I do not wish to declare the dependency in parent pom as I do
> not wish to inherit in all child poms.
> I simply wish to set the versions in one place and reference them when I
> need it.
>
> Thanks again.
>
> --
> Regards,
> Farrukh
>
> Web: http://www.wellfleetsoftware.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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