Hi!

I attached the patch for the AbstractWarMojo.

The changes against the actual subversion revision
(which is almost the state of 2.04) are only the
invocation of the MavenProjectHelper to set the jar as
attached artifact.

    projectHelper.attachArtifact( project, "jar",
"webclasses", jarFile );

The MavenProjectHelper setter mechanism is
automatically generated by the maven-plugin-plugin by
annotating it as @component:

    /**
     * @component
     */
    protected MavenProjectHelper projectHelper;

(You may also make it private due you don't need the
preparecp WarClassPathMojo)

You then have to switch the archiveClasses feature on
in the pom of the war you like to build:

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
         <version>2.0.4-msx.2-SNAPSHOT</version>
         <configuration>
           <archiveClasses>true</archiveClasses>
         </configuration>
      </plugin>
    </plugins>

Simply build it with 

mvn clean install

I also attached my personal maven-war-plugin pom which
reflects the mix of 2.1-SNAPTHOT and 2.0.4
productional changes i work against (this is a bit of
a hack, since i have to use this plugin in my company
which uses maven 2.04 and cannot switch to a complete
snapshot build)

best regards, 
strub

--- "Naess, Ronny" <[EMAIL PROTECTED]> schrieb:

> He provided a patch to be used. That shuld solve the
> problem. Maybe Mark
> kan give you som further information in how to use
> that patch?
> 
> -Ronny 
> 
> -----Opprinnelig melding-----
> Fra: Neeraj Bisht
> [mailto:[EMAIL PROTECTED] 
> Sendt: 9. oktober 2006 14:04
> Til: Maven Users List
> Emne: Re: jar and war together
> 
> at what extend i understand his thought i tried but
> get the same result
> as it was
> 
> On 10/9/06, Naess, Ronny <[EMAIL PROTECTED]>
> wrote:
> >
> > Did you take a look at what Mark Struberg wrote?
> >
> > -Ronny
> >
> > -----Opprinnelig melding-----
> > Fra: Neeraj Bisht
> [mailto:[EMAIL PROTECTED]
> > Sendt: 9. oktober 2006 13:19
> > Til: Maven Users List
> > Emne: Re: jar and war together
> >
> > yes inside jar , i  seen war content
> >
> >
> >
> > On 10/9/06, Naess, Ronny <[EMAIL PROTECTED]>
> wrote:
> > >
> > > What, it says it installes the war to the jar?
> Is it 
> > > replacing/moving it? Seems like strange
> behavior.
> > >
> > > Is it only the jar and now war inside
> C:\Documents and 
> > >
>
Settings\harvinder.bhutani.HARVINDER\.m2\repository\com\daffodilwood
> > > s\
> > > fr
> > > amework\dakwar\1.0-SNAPSHOT\
> > >
> > > If only the jar, if you look iside that jar, is
> it the war content 
> > > you
> >
> > > see?
> > >
> > > -Ronny
> > >
> > > -----Opprinnelig melding-----
> > > Fra: Neeraj Bisht
> [mailto:[EMAIL PROTECTED]
> > > Sendt: 9. oktober 2006 11:52
> > > Til: Maven Users List
> > > Emne: Re: jar and war together
> > >
> > > hi Ronny
> > >      i tried both way and not able to install
> the jar or war actully
> 
> > > it is installing jar but which is it installing
> is also wrong while 
> > > at
> >
> > > installing it show following message
> > >
> > > Installing
> > >
>
D:\data\localcvs\ABHIWORK\sample\Release\DAK\module\war\target\dakwa
> > > r- 1.0-SNAPSHOT.war to C:\Documents and 
> > >
>
Settings\harvinder.bhutani.HARVINDER\.m2\repository\com\daffodilwood
> > > s\
> > > fr
> > > amework\dakwar\1.0-SNAPSHOT\dakwar-
> > > 1.0-SNAPSHOT.jar
> > >
> > > On 10/9/06, Naess, Ronny <[EMAIL PROTECTED]>
> wrote:
> > > >
> > > > Sorry, I do not have the answer for why this
> is not working. Maybe
> 
> > > > you
> > >
> > > > could try it the other way around?
> > > > Change your pom to hav packaging to war, and
> specify 
> > > > maven-jar-plugin instead.
> > > >
> > > > We have more than one pom with packaging set
> to jar and at same 
> > > > time
> >
> > > > using maven-jar-plugin spesifying test-jar
> goal and both jars 
> > > > installs
> > >
> > > > correct to our repository.
> > > >
> > > > -Ronny
> > > >
> > > > -----Opprinnelig melding-----
> > > > Fra: neeraj daffodil
> [mailto:[EMAIL PROTECTED]
> > > > Sendt: 9. oktober 2006 09:40
> > > > Til: Maven Users List
> > > > Emne: Re: jar and war together
> > > >
> > > > i have simple pom which contain only one
> source and of this source
> 
> > > > i
> >
> > > > want to make war and jar
> > > >
> > > > means
> > > > 1)  i have one source and genrate jar and war
> of same source
> > > >
> > > > my pom is like
> > > >
> > > > <project>
> > > > <modelVersion>4.0.0</modelVersion>
> > > > <groupId>com.daffodilwoods.framework</groupId>
> > > > <artifactId>dakwar</artifactId>
> > > > <version> 1.0-SNAPSHOT</version>
> > > > <packaging>jar</packaging>  <!-- gunrate jar
> for my project --> 
> > > > <dependencies>
> > > >     <dependency>
> > > >
> > > >     ..............
> > > >     </dependency>
> > > > <dependencies>
> > > >
> > > >
> > > > <plugin> <!-- genrate war of same project -->
> > > >    
> <groupId>org.apache.maven.plugins</groupId>
> > > >       
> <artifactId>maven-war-plugin</artifactId>
> > > >        <executions>
> > > >          <execution>
> > > >            <phase>install</phase>
> > > >            <configuration>
> > > >    <echo>hi i am configuring the
> WarSourceDirectory..........
> > </echo>
> > > >             </configuration>
> > > >            <goals>
> > > >              <goal>war</goal>
> > > >            </goals>
> > > >          </execution>
> > > >        </executions>
> > > >      </plugin>
> > > >   </plugins>
> > > >
> > > >   <defaultGoal>package</defaultGoal>
> > > > </build>
> > > >
> > > > </project>
> > > >
> > > >
> > > >
> > > > i am able to genrate dakwar-1.0-SNAPSHOT.jar
> and
> > > >
> > > > dakwar-1.0-SNAPSHOT.war but only able to
> install 
> > > > dakwar-1.0-SNAPSHOT.jar
> > > >
> > > > in my local repository but i need both jar and
> war to be install 
> > > > in my
> > >
> > > > local repository
> > > >
> > > > i am doing these operation on one source
> > > >
> > > > how i can achieve this please tell
> > > >
> > > > Regards
> > > >
> > > > Neeraj
> > > >
> > > >
> > > >
> > > >
> > > >
> 
=== message truncated ===


                
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
Index: src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
===================================================================
--- src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java      (Revision 453164)
+++ src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java      (Arbeitskopie)
@@ -1,4 +1,4 @@
-package org.apache.maven.plugin.war;
+       package org.apache.maven.plugin.war;

 /*
  * Copyright 2001-2005 The Apache Software Foundation.
@@ -25,6 +25,7 @@
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.UnArchiver;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
@@ -68,6 +69,11 @@
     private MavenProject project;

     /**
+     * @component
+     */
+    protected MavenProjectHelper projectHelper;
+
+    /**
      * The directory containing generated classes.
      *
      * @parameter expression="${project.build.outputDirectory}"
@@ -476,6 +482,8 @@
             archiver.getArchiver().addDirectory( classesDirectory, getIncludes(), getExcludes() );

             archiver.createArchive( project, archive );
+
+            projectHelper.attachArtifact( project, "jar", "webclasses", jarFile );
         }
         catch ( Exception e )
         {
<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";>
  <parent>
    <artifactId>maven-plugins</artifactId>
    <groupId>org.apache.maven.plugins</groupId>
    <version>1</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>maven-war-plugin</artifactId>
  <packaging>maven-plugin</packaging>
  <name>Maven War Plugin</name>
  <version>2.0.4-msx.2-SNAPSHOT</version>
  
  <distributionManagement>
    <repository>
      <id>m2plugins.3united</id>
      <url>scp://10.0.0.25/home/maven/plugins</url>
      <name>3united maven2 plugin repository</name>
    </repository>
  </distributionManagement>
  
  <prerequisites>
    <maven>2.0.4</maven>
  </prerequisites>
  <issueManagement>
    <system>JIRA</system>
    <url>http://jira.codehaus.org/browse/MWAR</url>
  </issueManagement>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>2.0.4</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-project</artifactId>
      <version>2.0.4</version>
    </dependency>    
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-archiver</artifactId>
      <version>2.1</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
      <version>1.0.4</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-artifact</artifactId>
      <version>2.0.4</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.shared</groupId>
      <artifactId>maven-plugin-testing-harness</artifactId>
      <version>1.0-beta-1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to