Author: olamy Date: Mon Oct 3 22:14:49 2011 New Revision: 1178613 URL: http://svn.apache.org/viewvc?rev=1178613&view=rev Log: [MTOMCAT-62] tomcat7 support: start extracting common classes to an other module which will be shared in tomcat6 and tomcat7 plugins
Added: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/pom.xml (with props) tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/AbstractI18NTomcatMojo.java (contents, props changed) - copied, changed from r1177745, tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractI18NMojo.java tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractI18NTomcat6Mojo.java (with props) Removed: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractI18NMojo.java Modified: tomcat/maven-plugin/trunk/pom.xml tomcat/maven-plugin/trunk/tomcat6-maven-plugin/pom.xml tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractCatalinaMojo.java tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractRunMojo.java tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/ShutdownMojo.java Added: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/pom.xml URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/pom.xml?rev=1178613&view=auto ============================================================================== --- tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/pom.xml (added) +++ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/pom.xml Mon Oct 3 22:14:49 2011 @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>tomcat-maven-plugin</artifactId> + <groupId>org.apache.tomcat.maven</groupId> + <version>2.0-SNAPSHOT</version> + </parent> + <artifactId>common-tomcat-maven-plugin</artifactId> + <name>Tomcat Maven Plugin :: Common API</name> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + </dependency> + </dependencies> + +</project> Propchange: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/pom.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Copied: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/AbstractI18NTomcatMojo.java (from r1177745, tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractI18NMojo.java) URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/AbstractI18NTomcatMojo.java?p2=tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/AbstractI18NTomcatMojo.java&p1=tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractI18NMojo.java&r1=1177745&r2=1178613&rev=1178613&view=diff ============================================================================== --- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractI18NMojo.java (original) +++ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/AbstractI18NTomcatMojo.java Mon Oct 3 22:14:49 2011 @@ -1,4 +1,4 @@ -package org.apache.tomcat.maven.plugin; +package org.apache.tomcat.maven.common; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -19,33 +19,21 @@ package org.apache.tomcat.maven.plugin; * under the License. */ +import org.apache.maven.plugin.AbstractMojo; + import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; -import org.apache.maven.plugin.AbstractMojo; - /** * Abstract goal that provides i18n support. - * + * * @author Mark Hobson <markhob...@gmail.com> * @version $Id: AbstractI18NMojo.java 12852 2010-10-12 22:04:32Z thragor $ */ -public abstract class AbstractI18NMojo +public abstract class AbstractI18NTomcatMojo extends AbstractMojo { - // ---------------------------------------------------------------------- - // Mojo Parameters - // ---------------------------------------------------------------------- - - /** - * The webapp context path to use for the web application being run. This must always start with a forward-slash - * ('/'). - * - * @parameter expression="${maven.tomcat.path}" default-value="/${project.artifactId}" - * @required - */ - protected String path; // ---------------------------------------------------------------------- // Fields @@ -63,9 +51,9 @@ public abstract class AbstractI18NMojo /** * Creates a new <code>AbstractI18NMojo</code>. */ - public AbstractI18NMojo() + public AbstractI18NTomcatMojo( ) { - String packageName = getClass().getPackage().getName(); + String packageName = getClass( ).getPackage( ).getName( ); messages = ResourceBundle.getBundle( packageName + ".messages" ); } @@ -76,7 +64,7 @@ public abstract class AbstractI18NMojo /** * Gets the message for the given key from this packages resource bundle. - * + * * @param key the key for the required message * @return the message */ @@ -102,33 +90,33 @@ public abstract class AbstractI18NMojo /** * Gets the message for the given key from this packages resource bundle and formats it with the given parameter. - * - * @param key the key for the required message + * + * @param key the key for the required message * @param param the parameter to be used to format the message with * @return the formatted message */ protected String getMessage( String key, Object param ) { - return MessageFormat.format( getMessage( key ), new Object[] { param } ); + return MessageFormat.format( getMessage( key ), new Object[]{ param } ); } /** * Gets the message for the given key from this packages resource bundle and formats it with the given parameters. - * - * @param key the key for the required message + * + * @param key the key for the required message * @param param1 the first parameter to be used to format the message with * @param param2 the second parameter to be used to format the message with * @return the formatted message */ protected String getMessage( String key, Object param1, Object param2 ) { - return MessageFormat.format( getMessage( key ), new Object[] { param1, param2 } ); + return MessageFormat.format( getMessage( key ), new Object[]{ param1, param2 } ); } /** * Gets the message for the given key from this packages resource bundle and formats it with the given parameters. - * - * @param key the key for the required message + * + * @param key the key for the required message * @param params the parameters to be used to format the message with * @return the formatted message */ @@ -136,4 +124,6 @@ public abstract class AbstractI18NMojo { return MessageFormat.format( getMessage( key ), params ); } + + protected abstract String getPath(); } Propchange: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/AbstractI18NTomcatMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/AbstractI18NTomcatMojo.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Modified: tomcat/maven-plugin/trunk/pom.xml URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/pom.xml?rev=1178613&r1=1178612&r2=1178613&view=diff ============================================================================== --- tomcat/maven-plugin/trunk/pom.xml (original) +++ tomcat/maven-plugin/trunk/pom.xml Mon Oct 3 22:14:49 2011 @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="UTF-8"?> - <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file @@ -18,7 +17,6 @@ specific language governing permissions and limitations under the License. --> - <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/xsd/maven-4.0.0.xsd"> <!-- for more information, see the documentation of this POM: http://maven.apache.org/pom/maven/ --> @@ -205,13 +203,24 @@ </ciManagement> <modules> - <module>tomcat6-maven-plugin</module> + <module>common-tomcat-maven-plugin</module> <module>tomcat-maven-plugin-it</module> + <module>tomcat6-maven-plugin</module> </modules> <dependencyManagement> <dependencies> <dependency> + <groupId>org.apache.tomcat.maven</groupId> + <artifactId>common-tomcat-maven-plugin</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.tomcat.maven</groupId> + <artifactId>tomcat-maven-plugin-it</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> <version>${mavenVersion}</version> @@ -294,12 +303,6 @@ <artifactId>logback-classic</artifactId> <version>0.9.30</version> </dependency> - <dependency> - <groupId>org.apache.tomcat.maven</groupId> - <artifactId>tomcat-maven-plugin-it</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> </dependencyManagement> @@ -418,4 +421,4 @@ </plugins> </reporting> -</project> +</project> \ No newline at end of file Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/pom.xml URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/pom.xml?rev=1178613&r1=1178612&r2=1178613&view=diff ============================================================================== --- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/pom.xml (original) +++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/pom.xml Mon Oct 3 22:14:49 2011 @@ -43,6 +43,10 @@ <dependencies> <dependency> + <groupId>org.apache.tomcat.maven</groupId> + <artifactId>common-tomcat-maven-plugin</artifactId> + </dependency> + <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> </dependency> Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractCatalinaMojo.java URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractCatalinaMojo.java?rev=1178613&r1=1178612&r2=1178613&view=diff ============================================================================== --- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractCatalinaMojo.java (original) +++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractCatalinaMojo.java Mon Oct 3 22:14:49 2011 @@ -27,6 +27,7 @@ import java.util.StringTokenizer; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.wagon.authentication.AuthenticationInfo; +import org.apache.tomcat.maven.common.AbstractI18NTomcatMojo; import org.codehaus.plexus.util.StringUtils; /** @@ -36,7 +37,7 @@ import org.codehaus.plexus.util.StringUt * @version $Id: AbstractCatalinaMojo.java 12852 2010-10-12 22:04:32Z thragor $ */ public abstract class AbstractCatalinaMojo - extends AbstractI18NMojo + extends AbstractI18NTomcat6Mojo { // ---------------------------------------------------------------------- // Constants Added: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractI18NTomcat6Mojo.java URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractI18NTomcat6Mojo.java?rev=1178613&view=auto ============================================================================== --- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractI18NTomcat6Mojo.java (added) +++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractI18NTomcat6Mojo.java Mon Oct 3 22:14:49 2011 @@ -0,0 +1,49 @@ +package org.apache.tomcat.maven.plugin; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.tomcat.maven.common.AbstractI18NTomcatMojo; + +/** + * olamy: as long as maven plugin descriptor metadata generation doesn't support annotations outside of the same + * project, we must have those fields here + * @author Olivier Lamy + */ +public abstract class AbstractI18NTomcat6Mojo + extends AbstractI18NTomcatMojo +{ + // ---------------------------------------------------------------------- + // Mojo Parameters + // ---------------------------------------------------------------------- + + /** + * The webapp context path to use for the web application being run. This must always start with a forward-slash + * ('/'). + * + * @parameter expression="${maven.tomcat.path}" default-value="/${project.artifactId}" + * @required + */ + protected String path; + + @Override + protected String getPath( ) + { + return path; + } +} Propchange: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractI18NTomcat6Mojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractI18NTomcat6Mojo.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractRunMojo.java URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractRunMojo.java?rev=1178613&r1=1178612&r2=1178613&view=diff ============================================================================== --- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractRunMojo.java (original) +++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/AbstractRunMojo.java Mon Oct 3 22:14:49 2011 @@ -34,6 +34,7 @@ import org.apache.maven.artifact.resolve import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; +import org.apache.tomcat.maven.common.AbstractI18NTomcatMojo; import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.UnArchiver; import org.codehaus.plexus.archiver.manager.ArchiverManager; @@ -72,7 +73,7 @@ import java.util.Set; * @version $Id: AbstractRunMojo.java 14033 2011-05-04 17:51:15Z bimargulies $ */ public abstract class AbstractRunMojo - extends AbstractI18NMojo + extends AbstractI18NTomcat6Mojo { // ---------------------------------------------------------------------- // Mojo Parameters Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/ShutdownMojo.java URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/ShutdownMojo.java?rev=1178613&r1=1178612&r2=1178613&view=diff ============================================================================== --- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/ShutdownMojo.java (original) +++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/ShutdownMojo.java Mon Oct 3 22:14:49 2011 @@ -22,6 +22,7 @@ package org.apache.tomcat.maven.plugin; import org.apache.catalina.LifecycleException; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.tomcat.maven.common.AbstractI18NTomcatMojo; /** @@ -39,7 +40,7 @@ import org.apache.maven.plugin.MojoExecu * @since 1.1 */ public class ShutdownMojo - extends AbstractI18NMojo + extends AbstractI18NTomcat6Mojo { /** * Shuts down all embedded tomcats which got started up to now. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org