Author: olamy
Date: Sun Oct 16 07:43:11 2011
New Revision: 1184777

URL: http://svn.apache.org/viewvc?rev=1184777&view=rev
Log:
[MTOMCAT-102] Add a mojo to build a standalone jar to run a web application: 
use path field to store webapp to have a more nice name than 
projet.build.finalName

Modified:
    
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/it/simple-war-exec-project/pom.xml
    
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java

Modified: 
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/it/simple-war-exec-project/pom.xml
URL: 
http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/it/simple-war-exec-project/pom.xml?rev=1184777&r1=1184776&r2=1184777&view=diff
==============================================================================
--- 
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/it/simple-war-exec-project/pom.xml
 (original)
+++ 
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/it/simple-war-exec-project/pom.xml
 Sun Oct 16 07:43:11 2011
@@ -65,6 +65,7 @@
             </goals>
             <phase>package</phase>
             <configuration>
+              <path>foo</path>
               <serverXml>src/main/tomcatconf/server.xml</serverXml>
             </configuration>
           </execution>

Modified: 
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java
URL: 
http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java?rev=1184777&r1=1184776&r2=1184777&view=diff
==============================================================================
--- 
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java
 (original)
+++ 
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java
 Sun Oct 16 07:43:11 2011
@@ -109,6 +109,15 @@ public abstract class AbstractExecWarMoj
      */
     private String finalName;
 
+    /**
+     * The webapp context path to use for the web application being run.
+     * The name to store webapp in exec jar. Do not use /
+     *
+     * @parameter expression="${maven.tomcat.path}" 
default-value="${project.artifactId}"
+     * @required
+     */
+    protected String path;
+
     
     public void execute()
         throws MojoExecutionException, MojoFailureException
@@ -156,9 +165,8 @@ public abstract class AbstractExecWarMoj
             os =
                 new 
ArchiveStreamFactory().createArchiveOutputStream(ArchiveStreamFactory.JAR, 
execWarJarOutputStream);
 
-
             // TODO control project packaging is war
-            os.putArchiveEntry( new JarArchiveEntry( 
project.getBuild().getFinalName() + ".war" ) );
+            os.putArchiveEntry( new JarArchiveEntry( path + ".war" ) );
             IOUtils.copy( new FileInputStream(artifact.getFile()), os );
             os.closeArchiveEntry();
 
@@ -176,7 +184,7 @@ public abstract class AbstractExecWarMoj
                 properties.put(Tomcat7Runner.USE_SERVER_XML_KEY, 
Boolean.FALSE.toString() );
             }
 
-            properties.put( Tomcat7Runner.WARS_KEY , 
project.getBuild().getFinalName() + ".war" );
+            properties.put( Tomcat7Runner.WARS_KEY , path + ".war" );
             properties.store( tmpPropertiesFileOutputStream, "created by 
Apache Tomcat Maven plugin" );
 
             tmpPropertiesFileOutputStream.flush();



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to