Author: olamy Date: Tue Jun 19 15:31:34 2012 New Revision: 1351741 URL: http://svn.apache.org/viewvc?rev=1351741&view=rev Log: [MTOMCAT-60] Multiple-War-Deployment in configuration section. extract beans to reuse those with tomcat7 plugin. Submitted by Neale Upstone.
Added: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/config/ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/config/AbstractWebapp.java - copied, changed from r1351716, tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/Webapp.java Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractRunMojo.java tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/Webapp.java Copied: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/config/AbstractWebapp.java (from r1351716, tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/Webapp.java) URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/config/AbstractWebapp.java?p2=tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/config/AbstractWebapp.java&p1=tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/Webapp.java&r1=1351716&r2=1351741&rev=1351741&view=diff ============================================================================== --- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/Webapp.java (original) +++ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/config/AbstractWebapp.java Tue Jun 19 15:31:34 2012 @@ -1,4 +1,4 @@ -package org.apache.tomcat.maven.plugin.tomcat6; +package org.apache.tomcat.maven.common.config; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -23,38 +23,33 @@ import org.apache.commons.lang.StringUti import org.apache.maven.artifact.Artifact; /** - * Webapp represents information specified in the plugin configuration section - * for each webapp. - * * @since 2.0 */ -public class Webapp +public class AbstractWebapp { /** - * @parameter - * @required + * */ private String groupId; /** - * @parameter - * @required + * */ private String artifactId; /** - * @parameter + * */ private String version = null; /** - * @parameter + * */ private String type = "war"; /** - * @parameter + * */ private String classifier; @@ -65,12 +60,12 @@ public class Webapp private Artifact artifact; - public Webapp() + public AbstractWebapp() { - // default constructor + super(); } - public Webapp( Artifact artifact ) + public AbstractWebapp( Artifact artifact ) { this.setArtifact( artifact ); this.setGroupId( artifact.getGroupId() ); @@ -153,4 +148,5 @@ public class Webapp { this.artifact = artifact; } -} + +} \ No newline at end of file Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractRunMojo.java URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractRunMojo.java?rev=1351741&r1=1351740&r2=1351741&view=diff ============================================================================== --- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractRunMojo.java (original) +++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractRunMojo.java Tue Jun 19 15:31:34 2012 @@ -40,6 +40,7 @@ import org.apache.maven.artifact.version import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; +import org.apache.tomcat.maven.common.config.AbstractWebapp; import org.apache.tomcat.maven.common.run.EmbeddedRegistry; import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.UnArchiver; @@ -227,7 +228,7 @@ public abstract class AbstractRunMojo * * @parameter expression="${maven.tomcat.addContextWarDependencies}" default-value="false" * @since 1.0 - * @deprecated use additionalWebapps instead + * @deprecated use webapps instead */ private boolean addContextWarDependencies; @@ -372,7 +373,7 @@ public abstract class AbstractRunMojo * @see {@link Webapp} * @since 2.0 */ - private List<Webapp> additionalWebapps; + private List<Webapp> webapps; // ---------------------------------------------------------------------- // Fields @@ -800,8 +801,8 @@ public abstract class AbstractRunMojo createStaticContext( container, context, host ); if ( addContextWarDependencies || !getAdditionalWebapps().isEmpty() ) { - Collection<Context> dependecyContexts = createDependencyContexts( container ); - for ( Context extraContext : dependecyContexts ) + Collection<Context> dependencyContexts = createDependencyContexts( container ); + for ( Context extraContext : dependencyContexts ) { host.addChild( extraContext ); } @@ -875,11 +876,11 @@ public abstract class AbstractRunMojo private List<Webapp> getAdditionalWebapps() { - if ( additionalWebapps == null ) + if ( webapps == null ) { return Collections.emptyList(); } - return additionalWebapps; + return webapps; } protected ClassRealm getTomcatClassLoader() @@ -976,7 +977,7 @@ public abstract class AbstractRunMojo * "tomcat". * * @param container tomcat - * @return dependency tomcat contexts of warfiles in scope "tomcat" and those from additionalWebapps + * @return dependency tomcat contexts of warfiles in scope "tomcat" and those from webapps */ private Collection<Context> createDependencyContexts( Embedded container ) throws MojoExecutionException @@ -997,7 +998,7 @@ public abstract class AbstractRunMojo } } - for ( Webapp additionalWebapp : getAdditionalWebapps() ) + for ( AbstractWebapp additionalWebapp : getAdditionalWebapps() ) { addContextFromArtifact( container, contexts, getArtifact( additionalWebapp ), "/" + additionalWebapp.getContextPath() ); @@ -1073,7 +1074,7 @@ public abstract class AbstractRunMojo * @return Artifact object representing the specified file. * @throws MojoExecutionException with a message if the version can't be found in DependencyManagement. */ - protected Artifact getArtifact( Webapp additionalWebapp ) + protected Artifact getArtifact( AbstractWebapp additionalWebapp ) throws MojoExecutionException { Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/Webapp.java URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/Webapp.java?rev=1351741&r1=1351740&r2=1351741&view=diff ============================================================================== --- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/Webapp.java (original) +++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/Webapp.java Tue Jun 19 15:31:34 2012 @@ -19,8 +19,8 @@ package org.apache.tomcat.maven.plugin.t * under the License. */ -import org.apache.commons.lang.StringUtils; import org.apache.maven.artifact.Artifact; +import org.apache.tomcat.maven.common.config.AbstractWebapp; /** * Webapp represents information specified in the plugin configuration section @@ -29,42 +29,9 @@ import org.apache.maven.artifact.Artifac * @since 2.0 */ public class Webapp + extends AbstractWebapp { - /** - * @parameter - * @required - */ - private String groupId; - - /** - * @parameter - * @required - */ - private String artifactId; - - /** - * @parameter - */ - private String version = null; - - /** - * @parameter - */ - private String type = "war"; - - /** - * @parameter - */ - private String classifier; - - /** - * @parameter - */ - private String contextPath; - - private Artifact artifact; - public Webapp() { // default constructor @@ -72,85 +39,6 @@ public class Webapp public Webapp( Artifact artifact ) { - this.setArtifact( artifact ); - this.setGroupId( artifact.getGroupId() ); - this.setArtifactId( artifact.getArtifactId() ); - this.setVersion( artifact.getVersion() ); - this.setClassifier( artifact.getClassifier() ); - this.setType( artifact.getType() ); - } - - public String getGroupId() - { - return groupId; - } - - public void setGroupId( String groupId ) - { - this.groupId = groupId; - } - - public String getArtifactId() - { - return artifactId; - } - - public void setArtifactId( String artifactId ) - { - this.artifactId = artifactId; - } - - public String getVersion() - { - return version; - } - - public void setVersion( String version ) - { - this.version = version; - } - - public String getType() - { - return type; - } - - public void setType( String type ) - { - this.type = type; - } - - public String getClassifier() - { - return classifier; - } - - public void setClassifier( String classifier ) - { - this.classifier = classifier; - } - - public String getContextPath() - { - if ( StringUtils.isEmpty( contextPath ) ) - { - return this.artifactId; - } - return contextPath; - } - - public void setContextPath( String contextPath ) - { - this.contextPath = contextPath; - } - - public Artifact getArtifact() - { - return artifact; - } - - public void setArtifact( Artifact artifact ) - { - this.artifact = artifact; + super( artifact ); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org