You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jeremy Lewi <je...@lewi.us> on 2011/07/05 23:52:55 UTC

Dependencies in pom aggregation

Hi,

I'm working on the apache avro project and I'm having a problem with
maven that I was hoping to get some help with.

My project consists of several modules, one of which is "mapred".
Now I can build "mapred" just fine e.g by doing mvn package from within
the project.

Another module in the project is "tools". This module depends on the
"mapred" module. So its pom file declares the artifact for mapred as a
dependency. So far so good.

The problem is I would like to make the test class in the "tools"
modules depend on the "test" classes in "mapred". So I would like to
build a jar in "mapred" containing the "test" classes and then declare
this as a dependency for the test classes in "tools". 

In the mapred module I can build a jar  containing the test classes
by doing mvn jar:test-jar but I'm not sure how to add this jar as a
dependency for the "tools" module during testing.

Thanks
Jeremy





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


Re: Dependencies in pom aggregation

Posted by Stephen Connolly <st...@gmail.com>.
<type>test-jar</type>
<scope>test</scope>

On 5 July 2011 22:52, Jeremy Lewi <je...@lewi.us> wrote:

> Hi,
>
> I'm working on the apache avro project and I'm having a problem with
> maven that I was hoping to get some help with.
>
> My project consists of several modules, one of which is "mapred".
> Now I can build "mapred" just fine e.g by doing mvn package from within
> the project.
>
> Another module in the project is "tools". This module depends on the
> "mapred" module. So its pom file declares the artifact for mapred as a
> dependency. So far so good.
>
> The problem is I would like to make the test class in the "tools"
> modules depend on the "test" classes in "mapred". So I would like to
> build a jar in "mapred" containing the "test" classes and then declare
> this as a dependency for the test classes in "tools".
>
> In the mapred module I can build a jar  containing the test classes
> by doing mvn jar:test-jar but I'm not sure how to add this jar as a
> dependency for the "tools" module during testing.
>
> Thanks
> Jeremy
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Dependencies in pom aggregation

Posted by Jeremy Lewi <je...@lewi.us>.
Scott and Stephen,

Thank you both for the quick responses. That seems to have worked for
me.

For archival purposes the steps that seem to have worked for me are:

1. Modified the configuration for the jar-plugin as specified here
http://maven.apache.org/guides/mini/guide-attached-tests.html 
2. In tools I then declared a dependency on mapred using  
        <type>test-jar</type> 
        <scope>test</scope>
        
3. in mapred I did an mvn install to install the artifacts


J
        
On Tue, 2011-07-05 at 15:57 -0700, Scott Carey wrote:
> Maven can work with a 'test' dependency, by declaring the dependency of
> type "test-jar".
> 
> See 
> http://maven.apache.org/guides/mini/guide-attached-tests.html
> http://maven.apache.org/plugins/maven-jar-plugin/test-jar-mojo.html
> 
> Unfortunately there are some bugs in various Maven plugins so we have been
> avoiding using test-jars for now.  In particular, if you use a test-jar
> and then do:
> 
> $ mvn clean
> $ mvn compile
> 
> with no 'install' and no artifacts in your local repo, it may fail, trying
> to resolve and pull the test dependency during compile.  This is not the
> fault of the test-jar or dependency declaration, but bugs in various other
> plugins in our toolchain, see
> http://jira.codehaus.org/browse/MRRESOURCES-53.
> 
> -Scott
> 
> On 7/5/11 2:52 PM, "Jeremy Lewi" <je...@lewi.us> wrote:
> 
> >Hi,
> >
> >I'm working on the apache avro project and I'm having a problem with
> >maven that I was hoping to get some help with.
> >
> >My project consists of several modules, one of which is "mapred".
> >Now I can build "mapred" just fine e.g by doing mvn package from within
> >the project.
> >
> >Another module in the project is "tools". This module depends on the
> >"mapred" module. So its pom file declares the artifact for mapred as a
> >dependency. So far so good.
> >
> >The problem is I would like to make the test class in the "tools"
> >modules depend on the "test" classes in "mapred". So I would like to
> >build a jar in "mapred" containing the "test" classes and then declare
> >this as a dependency for the test classes in "tools".
> >
> >In the mapred module I can build a jar  containing the test classes
> >by doing mvn jar:test-jar but I'm not sure how to add this jar as a
> >dependency for the "tools" module during testing.
> >
> >Thanks
> >Jeremy
> >
> >
> >
> >
> 


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


Re: Dependencies in pom aggregation

Posted by Jeremy Lewi <je...@lewi.us>.
Scott and Stephen,

Thank you both for the quick responses. That seems to have worked for
me.

For archival purposes the steps that seem to have worked for me are:

1. Modified the configuration for the jar-plugin as specified here
http://maven.apache.org/guides/mini/guide-attached-tests.html 
2. In tools I then declared a dependency on mapred using  
        <type>test-jar</type> 
        <scope>test</scope>
        
3. in mapred I did an mvn install to install the artifacts


J
        
On Tue, 2011-07-05 at 15:57 -0700, Scott Carey wrote:
> Maven can work with a 'test' dependency, by declaring the dependency of
> type "test-jar".
> 
> See 
> http://maven.apache.org/guides/mini/guide-attached-tests.html
> http://maven.apache.org/plugins/maven-jar-plugin/test-jar-mojo.html
> 
> Unfortunately there are some bugs in various Maven plugins so we have been
> avoiding using test-jars for now.  In particular, if you use a test-jar
> and then do:
> 
> $ mvn clean
> $ mvn compile
> 
> with no 'install' and no artifacts in your local repo, it may fail, trying
> to resolve and pull the test dependency during compile.  This is not the
> fault of the test-jar or dependency declaration, but bugs in various other
> plugins in our toolchain, see
> http://jira.codehaus.org/browse/MRRESOURCES-53.
> 
> -Scott
> 
> On 7/5/11 2:52 PM, "Jeremy Lewi" <je...@lewi.us> wrote:
> 
> >Hi,
> >
> >I'm working on the apache avro project and I'm having a problem with
> >maven that I was hoping to get some help with.
> >
> >My project consists of several modules, one of which is "mapred".
> >Now I can build "mapred" just fine e.g by doing mvn package from within
> >the project.
> >
> >Another module in the project is "tools". This module depends on the
> >"mapred" module. So its pom file declares the artifact for mapred as a
> >dependency. So far so good.
> >
> >The problem is I would like to make the test class in the "tools"
> >modules depend on the "test" classes in "mapred". So I would like to
> >build a jar in "mapred" containing the "test" classes and then declare
> >this as a dependency for the test classes in "tools".
> >
> >In the mapred module I can build a jar  containing the test classes
> >by doing mvn jar:test-jar but I'm not sure how to add this jar as a
> >dependency for the "tools" module during testing.
> >
> >Thanks
> >Jeremy
> >
> >
> >
> >
> 


Re: Dependencies in pom aggregation

Posted by Scott Carey <sc...@richrelevance.com>.
Maven can work with a 'test' dependency, by declaring the dependency of
type "test-jar".

See 
http://maven.apache.org/guides/mini/guide-attached-tests.html
http://maven.apache.org/plugins/maven-jar-plugin/test-jar-mojo.html

Unfortunately there are some bugs in various Maven plugins so we have been
avoiding using test-jars for now.  In particular, if you use a test-jar
and then do:

$ mvn clean
$ mvn compile

with no 'install' and no artifacts in your local repo, it may fail, trying
to resolve and pull the test dependency during compile.  This is not the
fault of the test-jar or dependency declaration, but bugs in various other
plugins in our toolchain, see
http://jira.codehaus.org/browse/MRRESOURCES-53.

-Scott

On 7/5/11 2:52 PM, "Jeremy Lewi" <je...@lewi.us> wrote:

>Hi,
>
>I'm working on the apache avro project and I'm having a problem with
>maven that I was hoping to get some help with.
>
>My project consists of several modules, one of which is "mapred".
>Now I can build "mapred" just fine e.g by doing mvn package from within
>the project.
>
>Another module in the project is "tools". This module depends on the
>"mapred" module. So its pom file declares the artifact for mapred as a
>dependency. So far so good.
>
>The problem is I would like to make the test class in the "tools"
>modules depend on the "test" classes in "mapred". So I would like to
>build a jar in "mapred" containing the "test" classes and then declare
>this as a dependency for the test classes in "tools".
>
>In the mapred module I can build a jar  containing the test classes
>by doing mvn jar:test-jar but I'm not sure how to add this jar as a
>dependency for the "tools" module during testing.
>
>Thanks
>Jeremy
>
>
>
>