You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by jp4 <jo...@hnpsolutions.com> on 2007/04/19 18:18:52 UTC

POM for common libraries

I have a project (common-data-access) of type pom that is used to group a set
of common libraries for reuse.  In this case, I group all libraries that I
need for a data access project.  In each data access project in include
common-data-access as <type>pom</type>.  I have encountered two issues and I
was hoping someone could help me.  First, it appears as though artifacts
that are defined as <scope>provide</scope> in common-data-access are not 
recognized by projects that include common-data-access.  The oracle jar file
is one example.  In addition, it appears as though dependencies with a test
scope are also not recognized by projects that include common-data-access.  

Below is my pom.xml, am I doing something wrong here?

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">

	<modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.foo</groupId>
        <artifactId>common-maven-build</artifactId>
        <version>8.1-SNAPSHOT</version>
    </parent>

	<groupId>com.foo</groupId>
	<artifactId>common-data-access</artifactId>
	<version>8.1-SNAPSHOT</version>
	<name>${artifactId}</name>
	<packaging>pom</packaging>

    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>oracle_jdbc</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.foo</groupId>
            <artifactId>common-spring-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.foo</groupId>
            <artifactId>common-configuration</artifactId>
        </dependency>
        <dependency>
            <groupId>com.foo</groupId>
            <artifactId>common-abstract-unit-tests</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.foo</groupId>
            <artifactId>common-configuration</artifactId>
            <scope>test</scope>
            <type>test-jar</type>
        </dependency>
    </dependencies>

</project>
-- 
View this message in context: http://www.nabble.com/POM-for-common-libraries-tf3607983s177.html#a10080824
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: POM for common libraries

Posted by Wayne Fay <wa...@gmail.com>.
I hear you and don't disagree with the sentiment. I'm not entirely
sure how to reduce the management overhead and duplication in this
particular case.

Wayne

On 4/19/07, jp4 <jo...@hnpsolutions.com> wrote:
>
> Wayne,
>
> Thanks for the reply.  What you have described makes sense.  I guess I am
> just looking for a way to avoid including the same test and provided scoped
> dependencies in multiple projects that follow essentially the same design
> patterns.
>
> Thanks,
>
> jp4
>
>
> Wayne Fay wrote:
> >
> > What you're describing actually makes the most sense to me vs what
> > you're expecting...
> >
> > Test scope means: when I am testing this particular artifact, I need
> > to include these dependencies in the classpath. But you're not testing
> > this artifact -- you're simply including it as a dependency of another
> > artifact -- so why in the world would those test scoped artifacts come
> > in? If you need these dependencies to test this other
> > artifact/project, then it must attach them itself. (aka, test scope is
> > not transitive)
> >
> > Provide scope means: I need these artifacts to properly build and
> > use/run the code in this project, but I know these artifacts will be
> > provided by the environment I'll be executing in. When you bring this
> > dependency into another project, suddenly that new project is the
> > "environment" and so it must ensure that dependency is available in
> > the classpath (through provide or compile scope, as appropriate).
> > (aka, provide scope is not transitive)
> >
> > I think that what you're seeing is exactly how it should work, and
> > your expectations are simply invalid. But I'm happy to be proven wrong
> > or continue this discussion.
> >
> > Wayne
> >
> > On 4/19/07, jp4 <jo...@hnpsolutions.com> wrote:
> >>
> >> I have a project (common-data-access) of type pom that is used to group a
> >> set
> >> of common libraries for reuse.  In this case, I group all libraries that
> >> I
> >> need for a data access project.  In each data access project in include
> >> common-data-access as <type>pom</type>.  I have encountered two issues
> >> and I
> >> was hoping someone could help me.  First, it appears as though artifacts
> >> that are defined as <scope>provide</scope> in common-data-access are not
> >> recognized by projects that include common-data-access.  The oracle jar
> >> file
> >> is one example.  In addition, it appears as though dependencies with a
> >> test
> >> scope are also not recognized by projects that include
> >> common-data-access.
> >>
> >> Below is my pom.xml, am I doing something wrong here?
> >>
> >> <project xmlns="http://maven.apache.org/POM/4.0.0"
> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> >> http://maven.apache.org/maven-v4_0_0.xsd">
> >>
> >> 	<modelVersion>4.0.0</modelVersion>
> >>     <parent>
> >>         <groupId>com.foo</groupId>
> >>         <artifactId>common-maven-build</artifactId>
> >>         <version>8.1-SNAPSHOT</version>
> >>     </parent>
> >>
> >> 	<groupId>com.foo</groupId>
> >> 	<artifactId>common-data-access</artifactId>
> >> 	<version>8.1-SNAPSHOT</version>
> >> 	<name>${artifactId}</name>
> >> 	<packaging>pom</packaging>
> >>
> >>     <dependencies>
> >>         <dependency>
> >>             <groupId>org.hibernate</groupId>
> >>             <artifactId>hibernate</artifactId>
> >>         </dependency>
> >>         <dependency>
> >>             <groupId>org.springframework</groupId>
> >>             <artifactId>spring</artifactId>
> >>         </dependency>
> >>         <dependency>
> >>             <groupId>com.oracle</groupId>
> >>             <artifactId>oracle_jdbc</artifactId>
> >>             <scope>provided</scope>
> >>         </dependency>
> >>         <dependency>
> >>             <groupId>com.foo</groupId>
> >>             <artifactId>common-spring-util</artifactId>
> >>         </dependency>
> >>         <dependency>
> >>             <groupId>com.foo</groupId>
> >>             <artifactId>common-configuration</artifactId>
> >>         </dependency>
> >>         <dependency>
> >>             <groupId>com.foo</groupId>
> >>             <artifactId>common-abstract-unit-tests</artifactId>
> >>             <type>test-jar</type>
> >>             <scope>test</scope>
> >>         </dependency>
> >>         <dependency>
> >>             <groupId>log4j</groupId>
> >>             <artifactId>log4j</artifactId>
> >>             <scope>test</scope>
> >>         </dependency>
> >>         <dependency>
> >>             <groupId>com.foo</groupId>
> >>             <artifactId>common-configuration</artifactId>
> >>             <scope>test</scope>
> >>             <type>test-jar</type>
> >>         </dependency>
> >>     </dependencies>
> >>
> >> </project>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/POM-for-common-libraries-tf3607983s177.html#a10080824
> >> 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
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > 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/POM-for-common-libraries-tf3607983s177.html#a10082195
> 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
>
>

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


Re: POM for common libraries

Posted by jp4 <jo...@hnpsolutions.com>.
Wayne,

Thanks for the reply.  What you have described makes sense.  I guess I am
just looking for a way to avoid including the same test and provided scoped
dependencies in multiple projects that follow essentially the same design
patterns.

Thanks,

jp4


Wayne Fay wrote:
> 
> What you're describing actually makes the most sense to me vs what
> you're expecting...
> 
> Test scope means: when I am testing this particular artifact, I need
> to include these dependencies in the classpath. But you're not testing
> this artifact -- you're simply including it as a dependency of another
> artifact -- so why in the world would those test scoped artifacts come
> in? If you need these dependencies to test this other
> artifact/project, then it must attach them itself. (aka, test scope is
> not transitive)
> 
> Provide scope means: I need these artifacts to properly build and
> use/run the code in this project, but I know these artifacts will be
> provided by the environment I'll be executing in. When you bring this
> dependency into another project, suddenly that new project is the
> "environment" and so it must ensure that dependency is available in
> the classpath (through provide or compile scope, as appropriate).
> (aka, provide scope is not transitive)
> 
> I think that what you're seeing is exactly how it should work, and
> your expectations are simply invalid. But I'm happy to be proven wrong
> or continue this discussion.
> 
> Wayne
> 
> On 4/19/07, jp4 <jo...@hnpsolutions.com> wrote:
>>
>> I have a project (common-data-access) of type pom that is used to group a
>> set
>> of common libraries for reuse.  In this case, I group all libraries that
>> I
>> need for a data access project.  In each data access project in include
>> common-data-access as <type>pom</type>.  I have encountered two issues
>> and I
>> was hoping someone could help me.  First, it appears as though artifacts
>> that are defined as <scope>provide</scope> in common-data-access are not
>> recognized by projects that include common-data-access.  The oracle jar
>> file
>> is one example.  In addition, it appears as though dependencies with a
>> test
>> scope are also not recognized by projects that include
>> common-data-access.
>>
>> Below is my pom.xml, am I doing something wrong here?
>>
>> <project xmlns="http://maven.apache.org/POM/4.0.0"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/maven-v4_0_0.xsd">
>>
>> 	<modelVersion>4.0.0</modelVersion>
>>     <parent>
>>         <groupId>com.foo</groupId>
>>         <artifactId>common-maven-build</artifactId>
>>         <version>8.1-SNAPSHOT</version>
>>     </parent>
>>
>> 	<groupId>com.foo</groupId>
>> 	<artifactId>common-data-access</artifactId>
>> 	<version>8.1-SNAPSHOT</version>
>> 	<name>${artifactId}</name>
>> 	<packaging>pom</packaging>
>>
>>     <dependencies>
>>         <dependency>
>>             <groupId>org.hibernate</groupId>
>>             <artifactId>hibernate</artifactId>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.springframework</groupId>
>>             <artifactId>spring</artifactId>
>>         </dependency>
>>         <dependency>
>>             <groupId>com.oracle</groupId>
>>             <artifactId>oracle_jdbc</artifactId>
>>             <scope>provided</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>com.foo</groupId>
>>             <artifactId>common-spring-util</artifactId>
>>         </dependency>
>>         <dependency>
>>             <groupId>com.foo</groupId>
>>             <artifactId>common-configuration</artifactId>
>>         </dependency>
>>         <dependency>
>>             <groupId>com.foo</groupId>
>>             <artifactId>common-abstract-unit-tests</artifactId>
>>             <type>test-jar</type>
>>             <scope>test</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>log4j</groupId>
>>             <artifactId>log4j</artifactId>
>>             <scope>test</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>com.foo</groupId>
>>             <artifactId>common-configuration</artifactId>
>>             <scope>test</scope>
>>             <type>test-jar</type>
>>         </dependency>
>>     </dependencies>
>>
>> </project>
>> --
>> View this message in context:
>> http://www.nabble.com/POM-for-common-libraries-tf3607983s177.html#a10080824
>> 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
>>
>>
> 
> ---------------------------------------------------------------------
> 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/POM-for-common-libraries-tf3607983s177.html#a10082195
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: POM for common libraries

Posted by Wayne Fay <wa...@gmail.com>.
What you're describing actually makes the most sense to me vs what
you're expecting...

Test scope means: when I am testing this particular artifact, I need
to include these dependencies in the classpath. But you're not testing
this artifact -- you're simply including it as a dependency of another
artifact -- so why in the world would those test scoped artifacts come
in? If you need these dependencies to test this other
artifact/project, then it must attach them itself. (aka, test scope is
not transitive)

Provide scope means: I need these artifacts to properly build and
use/run the code in this project, but I know these artifacts will be
provided by the environment I'll be executing in. When you bring this
dependency into another project, suddenly that new project is the
"environment" and so it must ensure that dependency is available in
the classpath (through provide or compile scope, as appropriate).
(aka, provide scope is not transitive)

I think that what you're seeing is exactly how it should work, and
your expectations are simply invalid. But I'm happy to be proven wrong
or continue this discussion.

Wayne

On 4/19/07, jp4 <jo...@hnpsolutions.com> wrote:
>
> I have a project (common-data-access) of type pom that is used to group a
> set
> of common libraries for reuse.  In this case, I group all libraries that I
> need for a data access project.  In each data access project in include
> common-data-access as <type>pom</type>.  I have encountered two issues and I
> was hoping someone could help me.  First, it appears as though artifacts
> that are defined as <scope>provide</scope> in common-data-access are not
> recognized by projects that include common-data-access.  The oracle jar file
> is one example.  In addition, it appears as though dependencies with a test
> scope are also not recognized by projects that include common-data-access.
>
> Below is my pom.xml, am I doing something wrong here?
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
>
> 	<modelVersion>4.0.0</modelVersion>
>     <parent>
>         <groupId>com.foo</groupId>
>         <artifactId>common-maven-build</artifactId>
>         <version>8.1-SNAPSHOT</version>
>     </parent>
>
> 	<groupId>com.foo</groupId>
> 	<artifactId>common-data-access</artifactId>
> 	<version>8.1-SNAPSHOT</version>
> 	<name>${artifactId}</name>
> 	<packaging>pom</packaging>
>
>     <dependencies>
>         <dependency>
>             <groupId>org.hibernate</groupId>
>             <artifactId>hibernate</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.springframework</groupId>
>             <artifactId>spring</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>com.oracle</groupId>
>             <artifactId>oracle_jdbc</artifactId>
>             <scope>provided</scope>
>         </dependency>
>         <dependency>
>             <groupId>com.foo</groupId>
>             <artifactId>common-spring-util</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>com.foo</groupId>
>             <artifactId>common-configuration</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>com.foo</groupId>
>             <artifactId>common-abstract-unit-tests</artifactId>
>             <type>test-jar</type>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>log4j</groupId>
>             <artifactId>log4j</artifactId>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>com.foo</groupId>
>             <artifactId>common-configuration</artifactId>
>             <scope>test</scope>
>             <type>test-jar</type>
>         </dependency>
>     </dependencies>
>
> </project>
> --
> View this message in context:
> http://www.nabble.com/POM-for-common-libraries-tf3607983s177.html#a10080824
> 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
>
>

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