You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Frederick N. Brier" <fb...@multideck.com> on 2007/07/31 05:10:19 UTC

Excluding build .jars from .war

I am relatively new to Maven and my project is including a number of 
.jars which I believe are only needed by Maven at build time into my 
.war.  How do I stop them from being included?

maven-artifact-20.0.jar
maven-artifact-manager-2.0.jar
maven-model-2.0.jar
maven-plugin-api-2.0.jar
maven-profile-2.0.jar
maven-project-2.0.jar
maven-repository-metadata-2.0.jar
plexus-container-default-1.0-alpha-8.jar
plexus-utils-1.0.0.jar
plexus-utils-1.0.4.jar
wagon-provider-api-1.0-alpha-5.jar

It is also including the junit-2.8.1.jar and two copies of the 
xbean-*.jar, specifically xbean-2.0.0.jar and xbean-2.2.0.jar.  Also 
note that two versions of the plexus-utils-*.jar are included above.  
Now I am using the xmlbeans-maven-plugin mojo plugin.  Could this be 
causing some of the jar issues?  Thank you.

Fred

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


Re: Excluding build .jars from .war

Posted by Wayne Fay <wa...@gmail.com>.
I'd assume this is happening because some parent (or grandparent, or
grand-grandparent, etc) of your pom is including those jars as a
dependency. And so your own project is bringing them in as a
dependency, so they are included in your war.

You could try "mvn -X package" and then search the text-tree
dependency output to find out what specific artifact is bringing those
dependencies in, but I think this is a wasted effort, and agree with
Wendy that you need to remove that extraneous <parent> tag and fix up
your own dependencies. If you're lucky, the problem will resolve
itself with these changes.

Wayne

On 7/30/07, Frederick N. Brier <fb...@multideck.com> wrote:
> I was building off of the struts2-portlet-2.0.x.war example.  So I guess
> that means I need to travel up the pom parents tree and merge all the
> dependencies and other elements into my own pom?  I will try and attempt
> not to break anything.  Thank you.  Do you happen to know why all those
> .jars are being included in my .war?
>
> Fred
>
> Wendy Smoak wrote:
> > On 7/30/07, Frederick N. Brier <fb...@multideck.com> wrote:
> >
> >>    <parent>
> >>       <groupId>org.apache.struts</groupId>
> >>       <artifactId>struts2-apps</artifactId>
> >>       <version>2.0.9</version>
> >>    </parent>
> >>
> >
> > Using a pom from some else's project as your parent is unusual.  I'd
> > remove that and leave the dependencies on the struts jars.  You may
> > want to establish a 'struts.version' property so you don't have to
> > repeat it.
> >
> > Having this as a parent means you're following all the way up to the
> > ASF top-level parent pom, which is unlikely to be what you really want
> > -- your project web site will list all the Struts developers, for one
> > thing. :)
> >
> >
>
>
> ---------------------------------------------------------------------
> 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: Excluding build .jars from .war

Posted by Wendy Smoak <ws...@gmail.com>.
On 7/30/07, Frederick N. Brier <fb...@multideck.com> wrote:

> I was building off of the struts2-portlet-2.0.x.war example.  So I guess
> that means I need to travel up the pom parents tree and merge all the
> dependencies and other elements into my own pom?

No, you should just declare dependencies on the jars you need.  Maven
will include transitive dependencies for you.

-- 
Wendy

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


Re: Excluding build .jars from .war

Posted by "Frederick N. Brier" <fb...@multideck.com>.
I was building off of the struts2-portlet-2.0.x.war example.  So I guess 
that means I need to travel up the pom parents tree and merge all the 
dependencies and other elements into my own pom?  I will try and attempt 
not to break anything.  Thank you.  Do you happen to know why all those 
.jars are being included in my .war?

Fred

Wendy Smoak wrote:
> On 7/30/07, Frederick N. Brier <fb...@multideck.com> wrote:
>   
>>    <parent>
>>       <groupId>org.apache.struts</groupId>
>>       <artifactId>struts2-apps</artifactId>
>>       <version>2.0.9</version>
>>    </parent>
>>     
>
> Using a pom from some else's project as your parent is unusual.  I'd
> remove that and leave the dependencies on the struts jars.  You may
> want to establish a 'struts.version' property so you don't have to
> repeat it.
>
> Having this as a parent means you're following all the way up to the
> ASF top-level parent pom, which is unlikely to be what you really want
> -- your project web site will list all the Struts developers, for one
> thing. :)
>
>   


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


Re: Excluding build .jars from .war

Posted by Wendy Smoak <ws...@gmail.com>.
On 7/30/07, Frederick N. Brier <fb...@multideck.com> wrote:
>    <parent>
>       <groupId>org.apache.struts</groupId>
>       <artifactId>struts2-apps</artifactId>
>       <version>2.0.9</version>
>    </parent>

Using a pom from some else's project as your parent is unusual.  I'd
remove that and leave the dependencies on the struts jars.  You may
want to establish a 'struts.version' property so you don't have to
repeat it.

Having this as a parent means you're following all the way up to the
ASF top-level parent pom, which is unlikely to be what you really want
-- your project web site will list all the Struts developers, for one
thing. :)

-- 
Wendy

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


Re: Excluding build .jars from .war

Posted by "Frederick N. Brier" <fb...@multideck.com>.
Here it is:

<?xml version="1.0" encoding="UTF-8"?>
<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>org.apache.struts</groupId>
      <artifactId>struts2-apps</artifactId>
      <version>2.0.9</version>
   </parent>
   <groupId>com.mycompany.portlet</groupId>
   <artifactId>myportlet</artifactId>
   <packaging>war</packaging>
   <name>Portlet</name>
   <url>http://www.mycompany.com</url>

   <scm>
      <connection></connection>
      <developerConnection></developerConnection>
      <url></url>
   </scm>

   <developers>
      <developer>
         <id>1</id>
         <name>Frederick N. Brier</name>
         <email>fbrier at multideck.com</email>
         <timezone>EDT5</timezone>
      </developer>
   </developers>
   <build>
      <resources>
         <!-- Include resources under src/main/java in WEB-INF/classes -->
         <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
         </resource>
         <resource>
            <directory>src/main/java</directory>
            <filtering>true</filtering>
            <includes>
               <include>**/*.properties</include>
               <include>**/*.xml</include>
            </includes>
         </resource>
      </resources>
      <defaultGoal>package</defaultGoal>
      <plugins>
         <plugin>
            <artifactId>maven-idea-plugin</artifactId>
            <version>2.1</version>
            <configuration>
               <downloadSources>true</downloadSources>
               <downloadJavadocs>true</downloadJavadocs>
               <dependenciesAsLibraries>true</dependenciesAsLibraries>
               <useFullNames>false</useFullNames>
               <libraries>
                  <library>
                     <name>Generated XMLBeans Source</name>
                     <sources>target/xmlbeans-source</sources>
                  </library>
               </libraries>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>xmlbeans-maven-plugin</artifactId>
            <executions>
               <execution>
                  <goals>
                     <goal>xmlbeans</goal>
                  </goals>
               </execution>
            </executions>
            <dependencies>
               <dependency>
                  <groupId>xmlbeans</groupId>
                  <artifactId>xbean</artifactId>
                  <version>2.2.0</version>
               </dependency>
            </dependencies>
            <inherited>true</inherited>
            <configuration>
               <schemaDirectory>src/main/xsd</schemaDirectory>
               
<sourceGenerationDirectory>target/xmlbeans-source</sourceGenerationDirectory>
            </configuration>
         </plugin>
      </plugins>
   </build>
   <dependencies>

      <dependency>
         <groupId>portlet-api</groupId>
         <artifactId>portlet-api</artifactId>
         <version>1.0</version>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.apache.struts</groupId>
         <artifactId>struts2-spring-plugin</artifactId>
         <version>${pom.version}</version>
      </dependency>

      <dependency>
         <groupId>org.apache.struts</groupId>
         <artifactId>struts2-core</artifactId>
         <version>${pom.version}</version>
      </dependency>

      <dependency>
         <groupId>velocity</groupId>
         <artifactId>velocity</artifactId>
         <version>1.4</version>
      </dependency>

      <dependency>
         <groupId>velocity-tools</groupId>
         <artifactId>velocity-tools</artifactId>
         <version>1.1</version>
      </dependency>

      <dependency>
         <groupId>commons-digester</groupId>
         <artifactId>commons-digester</artifactId>
         <version>1.8</version>
      </dependency>

      <dependency>
         <groupId>commons-dbcp</groupId>
         <artifactId>commons-dbcp</artifactId>
         <version>1.1</version>
      </dependency>

      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
         <version>2.4</version>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>commons-lang</groupId>
         <artifactId>commons-lang</artifactId>
         <version>2.0</version>
      </dependency>

      <dependency>
         <groupId>xmlbeans</groupId>
         <artifactId>xbean</artifactId>
         <version>2.2.0</version>
      </dependency>

      <dependency>
         <groupId>com.googlecode.tabletags</groupId>
         <artifactId>tabletags</artifactId>
         <version>1.0.1-SNAPSHOT</version>
      </dependency>

      <dependency>
         <groupId>javax.persistence</groupId>
         <artifactId>persistence-api</artifactId>
         <version>1.0</version>
      </dependency>
   </dependencies>

   <properties>
      <!-- Application settings -->
      <copyright.year>2007</copyright.year>

      
<hibernate.dialect>org.hibernate.dialect.MySQLInnoDBDialect</hibernate.dialect>
      <jdbc.groupId>mysql</jdbc.groupId>
      <jdbc.artifactId>mysql-connector-java</jdbc.artifactId>
      <jdbc.version>5.0.5</jdbc.version>
      <jdbc.driverClassName>com.mysql.jdbc.Driver</jdbc.driverClassName>
      <jdbc.url>
         
<![CDATA[jdbc:mysql://localhost/gridportlet?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8]]></jdbc.url>
      <jdbc.username>root</jdbc.username>
      <jdbc.password></jdbc.password>
   </properties>
</project>


Wayne Fay wrote:
> Show us your pom. You must be doing something wrong -- I've never seen
> any of those jars including in any wars I've ever constructed.
>
> Wayne
>
> On 7/30/07, Frederick N. Brier <fb...@multideck.com> wrote:
>   
>> I am relatively new to Maven and my project is including a number of
>> .jars which I believe are only needed by Maven at build time into my
>> .war.  How do I stop them from being included?
>>
>> maven-artifact-20.0.jar
>> maven-artifact-manager-2.0.jar
>> maven-model-2.0.jar
>> maven-plugin-api-2.0.jar
>> maven-profile-2.0.jar
>> maven-project-2.0.jar
>> maven-repository-metadata-2.0.jar
>> plexus-container-default-1.0-alpha-8.jar
>> plexus-utils-1.0.0.jar
>> plexus-utils-1.0.4.jar
>> wagon-provider-api-1.0-alpha-5.jar
>>
>> It is also including the junit-2.8.1.jar and two copies of the
>> xbean-*.jar, specifically xbean-2.0.0.jar and xbean-2.2.0.jar.  Also
>> note that two versions of the plexus-utils-*.jar are included above.
>> Now I am using the xmlbeans-maven-plugin mojo plugin.  Could this be
>> causing some of the jar issues?  Thank you.
>>
>> Fred
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>   


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


Re: Excluding build .jars from .war

Posted by Wayne Fay <wa...@gmail.com>.
Show us your pom. You must be doing something wrong -- I've never seen
any of those jars including in any wars I've ever constructed.

Wayne

On 7/30/07, Frederick N. Brier <fb...@multideck.com> wrote:
> I am relatively new to Maven and my project is including a number of
> .jars which I believe are only needed by Maven at build time into my
> .war.  How do I stop them from being included?
>
> maven-artifact-20.0.jar
> maven-artifact-manager-2.0.jar
> maven-model-2.0.jar
> maven-plugin-api-2.0.jar
> maven-profile-2.0.jar
> maven-project-2.0.jar
> maven-repository-metadata-2.0.jar
> plexus-container-default-1.0-alpha-8.jar
> plexus-utils-1.0.0.jar
> plexus-utils-1.0.4.jar
> wagon-provider-api-1.0-alpha-5.jar
>
> It is also including the junit-2.8.1.jar and two copies of the
> xbean-*.jar, specifically xbean-2.0.0.jar and xbean-2.2.0.jar.  Also
> note that two versions of the plexus-utils-*.jar are included above.
> Now I am using the xmlbeans-maven-plugin mojo plugin.  Could this be
> causing some of the jar issues?  Thank you.
>
> Fred
>
> ---------------------------------------------------------------------
> 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