You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by skatz <st...@nexage.com> on 2010/08/24 23:41:52 UTC

WAR type and transitive dependencies

I am building a war (a.war) that depends on a jar (depend1.jar).  That jar
(depend1.jar) is provided by the the App server (actually it is something we
build, but we install it globally), so it is in a.war pom.xml as "provided".  

The thing is, depend1.jar depends on several other jars, but since it is
"provided" those jars must be listed individually in a.war pom.xml as well.

a.war -depends--> depend1.jar -depends--> depend[2..N].jar

Is there a way to, when building a war, have a jar and all its dependencies
be part of the compile time path, but not be included in the war file
itself, without having to list each one in the pom.xml?

thanks,

skatz
-- 
View this message in context: http://maven.40175.n5.nabble.com/WAR-type-and-transitive-dependencies-tp2651850p2651850.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: WAR type and transitive dependencies

Posted by Ron Wheeler <rw...@artifact-software.com>.
  If your code depends on activation, then you want to list it.
What if mail changes their dependencies, you would not have it in your 
compile.

If you import it, you need to specify it.
You don't want your IDE looking through the whole dependency tree to 
resolve each import.

Maven is running the right way now.

Ron


On 30/08/2010 5:30 AM, Ognjen Blagojevic wrote:
> On 24.8.2010 23:41, skatz wrote:
>> Is there a way to, when building a war, have a jar and all its 
>> dependencies
>> be part of the compile time path, but not be included in the war file
>> itself, without having to list each one in the pom.xml?
>
> That is the way Maven should behave by default.
>
> For instance, if you define javax.mail in pom.xml:
>
> <dependency>
> <groupId>javax.mail</groupId>
> <artifactId>mail</artifactId>
> <version>1.4.2</version>
> <scope>provided</scope>
> </dependency>
>
> mvn dependency:tree shows also transitive depndecy javax.activation:
>
> [INFO] +- javax.mail:mail:jar:1.4.2:provided (scope not updated to 
> compile)
> [INFO] |  \- javax.activation:activation:jar:1.1:provided
>
> Which will be available at compile time, and not packed inside WAR.
>
> Regards,
> Ognjen
>
>
> ---------------------------------------------------------------------
> 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


Local build of SNAPSHOT prevents update from Nexus

Posted by Halvor Platou <Ha...@marinecyb.com>.
If a snapshot project is built locally(mvn install) the "maven-metadata-local.xml" is created in my local repository with the following contents:

<metadata>
  <groupId>x.y.z</groupId>
  <artifactId>module_a</artifactId>
  <version>1.0-SNAPSHOT</version>
  <versioning>
    <snapshot>
      <localCopy>true</localCopy>
    </snapshot>
    <lastUpdated>20100826143752</lastUpdated>
  </versioning>
</metadata>

This seems to prevent this module from being updated from Nexus in later builds. Today the maven-metadata.xml from our Nexus server looks like this:

<metadata>
<groupId>x.y.z</groupId>
<artifactId>module_a</artifactId>
<version>1.0-SNAPSHOT</version>
  <versioning>
    <snapshot>
      <buildNumber>48</buildNumber>
    </snapshot>
    <lastUpdated>20100830024102</lastUpdated>
  </versioning>
</metadata>

The version on Nexus is 4 days newer than the one in my local repo, but it will not be updated when I build a project with dependency on "module_a". The <updatePolicy> for the repo is set to "daily".

Will the tag <localCopy> prevent updates of snapshots? And if so, is it a setting to prevent this tag from being created in the local repo?

Halvor





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


Re: WAR type and transitive dependencies

Posted by Jesse Farinacci <ji...@gmail.com>.
Greetings,

On Mon, Aug 30, 2010 at 5:30 AM, Ognjen Blagojevic
<og...@gmail.com> wrote:
> For instance, if you define javax.mail in pom.xml:
>
> <dependency>
>  <groupId>javax.mail</groupId>
>  <artifactId>mail</artifactId>
>  <version>1.4.2</version>
>  <scope>provided</scope>
> </dependency>
>
> mvn dependency:tree shows also transitive depndecy javax.activation:
>
> [INFO] +- javax.mail:mail:jar:1.4.2:provided (scope not updated to compile)
> [INFO] |  \- javax.activation:activation:jar:1.1:provided
>
> Which will be available at compile time, and not packed inside WAR.

You could also watch/vote for http://jira.codehaus.org/browse/MDEP-283
which would let you create these skinny WARs more or less dynamically.
But certainly in an easier way than manually updating POM files.

-Jesse

-- 
There are 10 types of people in this world, those
that can read binary and those that can not.

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


Re: WAR type and transitive dependencies

Posted by Ognjen Blagojevic <og...@gmail.com>.
On 24.8.2010 23:41, skatz wrote:
> Is there a way to, when building a war, have a jar and all its dependencies
> be part of the compile time path, but not be included in the war file
> itself, without having to list each one in the pom.xml?

That is the way Maven should behave by default.

For instance, if you define javax.mail in pom.xml:

<dependency>
   <groupId>javax.mail</groupId>
   <artifactId>mail</artifactId>
   <version>1.4.2</version>
   <scope>provided</scope>
</dependency>

mvn dependency:tree shows also transitive depndecy javax.activation:

[INFO] +- javax.mail:mail:jar:1.4.2:provided (scope not updated to compile)
[INFO] |  \- javax.activation:activation:jar:1.1:provided

Which will be available at compile time, and not packed inside WAR.

Regards,
Ognjen


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