You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ol...@apache.org on 2011/10/17 16:06:09 UTC
svn commit: r1185186 [2/3] - in /tomcat/maven-plugin/trunk:
common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/deployer/
common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/messages/
common-tomcat-maven-plugin/s...
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ExternalRepositoriesReloadableWebappLoader.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ExternalRepositoriesReloadableWebappLoader.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ExternalRepositoriesReloadableWebappLoader.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ExternalRepositoriesReloadableWebappLoader.java Mon Oct 17 14:06:08 2011
@@ -34,27 +34,32 @@ import java.util.Map;
* context reloads.
*
* @author Ryan Connolly
- * @since 2.0
* @version $Id: ExternalRepositoriesReloadableWebappLoader.java 13551 2011-02-09 16:05:47Z olamy $
+ * @since 2.0
*/
public class ExternalRepositoriesReloadableWebappLoader
extends WebappLoader
{
- /** Last modification times of all jar and class files. */
+ /**
+ * Last modification times of all jar and class files.
+ */
private Map<String, Long> modificationTimeMap = new HashMap<String, Long>();
private Log log;
-
- /** Default Constructor. */
+
+ /**
+ * Default Constructor.
+ */
public ExternalRepositoriesReloadableWebappLoader()
{
super();
}
-
-
+
+
/**
* Convenience Constructor allows setting of a parent ClassLoader.
+ *
* @param parent the ClassLoader instance to set as this Loader's parent ClassLoader.
*/
public ExternalRepositoriesReloadableWebappLoader( ClassLoader parent, Log log )
@@ -90,6 +95,7 @@ public class ExternalRepositoriesReloada
/**
* Tracks modification times of files in the given class directory.
+ *
* @param directory the File directory to track modification times for.
*/
private void addClassDirectory( File directory )
@@ -111,6 +117,7 @@ public class ExternalRepositoriesReloada
/**
* Tracks last modification time of the given File.
+ *
* @param file the File for which to track last modification time.
*/
private void addFile( File file )
@@ -127,10 +134,10 @@ public class ExternalRepositoriesReloada
boolean modified = super.modified();
if ( !modified )
{
- if (log != null )
+ if ( log != null )
{
log.debug( "classPath scanning started at " + new Date().toString() );
- }
+ }
for ( Map.Entry<String, Long> entry : modificationTimeMap.entrySet() )
{
String key = entry.getKey();
@@ -143,7 +150,7 @@ public class ExternalRepositoriesReloada
{
modified = true;
modificationTimeMap.put( key, file.lastModified() );
-
+
// directory last modification time can change when some class,
// jar or subdirectory was added or deleted.
if ( file.isDirectory() )
@@ -154,7 +161,7 @@ public class ExternalRepositoriesReloada
}
}
}
- if (log != null )
+ if ( log != null )
{
log.debug( "context " + modified + " at " + new Date().toString() );
}
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/InplaceMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/InplaceMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/InplaceMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/InplaceMojo.java Mon Oct 17 14:06:08 2011
@@ -19,16 +19,16 @@ package org.apache.tomcat.maven.plugin.t
* under the License.
*/
-import java.io.File;
-
import org.apache.maven.plugin.MojoExecutionException;
+import java.io.File;
+
/**
* Deploy a WAR in-place to Tomcat.
- *
- * @goal inplace
+ *
* @author Mark Hobson <ma...@gmail.com>
* @version $Id: InplaceMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal inplace
* @todo depend on war:inplace when MNG-1649 resolved
*/
public class InplaceMojo
@@ -40,7 +40,7 @@ public class InplaceMojo
/**
* The path of the inplace WAR directory to deploy.
- *
+ *
* @parameter expression = "${basedir}/src/main/webapp"
* @required
*/
@@ -68,7 +68,8 @@ public class InplaceMojo
{
if ( !warSourceDirectory.exists() || !warSourceDirectory.isDirectory() )
{
- throw new MojoExecutionException( messagesProvider.getMessage( "InplaceMojo.missingWar", warSourceDirectory.getPath() ) );
+ throw new MojoExecutionException(
+ messagesProvider.getMessage( "InplaceMojo.missingWar", warSourceDirectory.getPath() ) );
}
}
}
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ListMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ListMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ListMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ListMojo.java Mon Oct 17 14:06:08 2011
@@ -26,10 +26,10 @@ import java.io.IOException;
/**
* Lists all the currently deployed web applications in Tomcat.
- *
- * @goal list
+ *
* @author Mark Hobson <ma...@gmail.com>
* @version $Id: ListMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal list
*/
public class ListMojo
extends AbstractCatalinaMojo
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RedeployMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RedeployMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RedeployMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RedeployMojo.java Mon Oct 17 14:06:08 2011
@@ -21,10 +21,10 @@ package org.apache.tomcat.maven.plugin.t
/**
* Redeploy a WAR in Tomcat. Deploy with forcing update flag to true
- *
- * @goal redeploy
+ *
* @author Mark Hobson <ma...@gmail.com>
* @version $Id: RedeployMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal redeploy
* @todo depend on war:war, war:exploded or war:inplace when MNG-1649 resolved
*/
public class RedeployMojo
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ReloadMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ReloadMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ReloadMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ReloadMojo.java Mon Oct 17 14:06:08 2011
@@ -26,10 +26,10 @@ import java.io.IOException;
/**
* Reload a WAR in Tomcat.
- *
- * @goal reload
+ *
* @author olamy
* @version $Id: ReloadMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal reload
*/
public class ReloadMojo
extends AbstractWarCatalinaMojo
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ResourcesMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ResourcesMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ResourcesMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ResourcesMojo.java Mon Oct 17 14:06:08 2011
@@ -26,10 +26,10 @@ import java.io.IOException;
/**
* Lists JNDI resources in Tomcat.
- *
- * @goal resources
+ *
* @author Mark Hobson <ma...@gmail.com>
* @version $Id: ResourcesMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal resources
*/
public class ResourcesMojo
extends AbstractCatalinaMojo
@@ -40,7 +40,7 @@ public class ResourcesMojo
/**
* The class name of the resources to list, or <code>null</code> for all.
- *
+ *
* @parameter expression = "${maven.tomcat.type}"
*/
private String type;
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RolesMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RolesMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RolesMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RolesMojo.java Mon Oct 17 14:06:08 2011
@@ -26,10 +26,10 @@ import java.io.IOException;
/**
* Lists security roles in Tomcat.
- *
- * @goal roles
+ *
* @author Mark Hobson <ma...@gmail.com>
* @version $Id: RolesMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal roles
*/
public class RolesMojo
extends AbstractCatalinaMojo
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunMojo.java Mon Oct 17 14:06:08 2011
@@ -120,12 +120,12 @@ public class RunMojo
* @throws MojoExecutionException
*/
@Override
- protected Context createContext(Embedded container)
+ protected Context createContext( Embedded container )
throws IOException, MojoExecutionException
{
- Context context = super.createContext(container);
+ Context context = super.createContext( container );
- context.setReloadable(isContextReloadable());
+ context.setReloadable( isContextReloadable() );
return context;
}
@@ -142,29 +142,28 @@ public class RunMojo
WebappLoader loader = super.createWebappLoader();
if ( useSeparateTomcatClassLoader )
{
- loader.setDelegate(delegate);
+ loader.setDelegate( delegate );
}
try
{
ClassLoaderEntriesCalculatorRequest request =
- new ClassLoaderEntriesCalculatorRequest().setDependencies( dependencies )
- .setLog( getLog() ).setMavenProject( project )
- .setAddWarDependenciesInClassloader( addWarDependenciesInClassloader );
- List<String> classLoaderEntries =
- classLoaderEntriesCalculator.calculateClassPathEntries(request);
+ new ClassLoaderEntriesCalculatorRequest().setDependencies( dependencies ).setLog(
+ getLog() ).setMavenProject( project ).setAddWarDependenciesInClassloader(
+ addWarDependenciesInClassloader );
+ List<String> classLoaderEntries = classLoaderEntriesCalculator.calculateClassPathEntries( request );
if ( classLoaderEntries != null )
{
for ( String classLoaderEntry : classLoaderEntries )
{
- loader.addRepository(classLoaderEntry);
+ loader.addRepository( classLoaderEntry );
}
}
}
catch ( TomcatRunException e )
{
- throw new MojoExecutionException(e.getMessage(), e);
+ throw new MojoExecutionException( e.getMessage(), e );
}
return loader;
@@ -201,32 +200,32 @@ public class RunMojo
StringWriter sw = new StringWriter();
try
{
- temporaryContextFile = File.createTempFile("tomcat-maven-plugin", "temp-ctx-file");
+ temporaryContextFile = File.createTempFile( "tomcat-maven-plugin", "temp-ctx-file" );
temporaryContextFile.deleteOnExit();
- fw = new FileWriter(temporaryContextFile);
+ fw = new FileWriter( temporaryContextFile );
// format to modify/create <Context backgroundProcessorDelay="5" reloadable="false">
if ( contextFile != null && contextFile.exists() )
{
- fr = new FileReader(contextFile);
- Xpp3Dom xpp3Dom = Xpp3DomBuilder.build(fr);
- xpp3Dom.setAttribute("backgroundProcessorDelay", Integer.toString(backgroundProcessorDelay));
- xpp3Dom.setAttribute("reloadable", Boolean.toString(isContextReloadable()));
- Xpp3DomWriter.write(fw, xpp3Dom);
- Xpp3DomWriter.write(sw, xpp3Dom);
- getLog().debug(" generated context file " + sw.toString());
+ fr = new FileReader( contextFile );
+ Xpp3Dom xpp3Dom = Xpp3DomBuilder.build( fr );
+ xpp3Dom.setAttribute( "backgroundProcessorDelay", Integer.toString( backgroundProcessorDelay ) );
+ xpp3Dom.setAttribute( "reloadable", Boolean.toString( isContextReloadable() ) );
+ Xpp3DomWriter.write( fw, xpp3Dom );
+ Xpp3DomWriter.write( sw, xpp3Dom );
+ getLog().debug( " generated context file " + sw.toString() );
}
else
{
if ( contextReloadable )
{
// don't care about using a complicated xml api to create one xml line :-)
- StringBuilder sb = new StringBuilder("<Context ").append("backgroundProcessorDelay=\"").append(
- Integer.toString(backgroundProcessorDelay)).append("\"").append(
- " reloadable=\"" + Boolean.toString(isContextReloadable()) + "\"/>");
+ StringBuilder sb = new StringBuilder( "<Context " ).append( "backgroundProcessorDelay=\"" ).append(
+ Integer.toString( backgroundProcessorDelay ) ).append( "\"" ).append(
+ " reloadable=\"" + Boolean.toString( isContextReloadable() ) + "\"/>" );
- getLog().debug(" generated context file " + sb.toString());
+ getLog().debug( " generated context file " + sb.toString() );
- fw.write(sb.toString());
+ fw.write( sb.toString() );
}
else
{
@@ -237,19 +236,19 @@ public class RunMojo
}
catch ( IOException e )
{
- getLog().error("error creating fake context.xml : " + e.getMessage(), e);
- throw new MojoExecutionException("error creating fake context.xml : " + e.getMessage(), e);
+ getLog().error( "error creating fake context.xml : " + e.getMessage(), e );
+ throw new MojoExecutionException( "error creating fake context.xml : " + e.getMessage(), e );
}
catch ( XmlPullParserException e )
{
- getLog().error("error creating fake context.xml : " + e.getMessage(), e);
- throw new MojoExecutionException("error creating fake context.xml : " + e.getMessage(), e);
+ getLog().error( "error creating fake context.xml : " + e.getMessage(), e );
+ throw new MojoExecutionException( "error creating fake context.xml : " + e.getMessage(), e );
}
finally
{
- IOUtil.close(fw);
- IOUtil.close(fr);
- IOUtil.close(sw);
+ IOUtil.close( fw );
+ IOUtil.close( fr );
+ IOUtil.close( sw );
}
return temporaryContextFile;
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunWarOnlyMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunWarOnlyMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunWarOnlyMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/RunWarOnlyMojo.java Mon Oct 17 14:06:08 2011
@@ -22,12 +22,10 @@ package org.apache.tomcat.maven.plugin.t
/**
* Runs the current project as a packaged web application using an embedded Tomcat server without forking the package cycle.
- *
- *
+ *
+ * @author vlatombe
* @goal run-war-only
* @requiresDependencyResolution runtime
- * @author vlatombe
- * @version
*/
public class RunWarOnlyMojo
extends AbstractRunWarMojo
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ServerInfoMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ServerInfoMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ServerInfoMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ServerInfoMojo.java Mon Oct 17 14:06:08 2011
@@ -26,10 +26,10 @@ import java.io.IOException;
/**
* Lists information about the Tomcat version, OS, and JVM properties.
- *
- * @goal info
+ *
* @author Mark Hobson <ma...@gmail.com>
* @version $Id: ServerInfoMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal info
*/
public class ServerInfoMojo
extends AbstractCatalinaMojo
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/SessionsMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/SessionsMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/SessionsMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/SessionsMojo.java Mon Oct 17 14:06:08 2011
@@ -26,10 +26,10 @@ import java.io.IOException;
/**
* Lists session information for a WAR in Tomcat.
- *
- * @goal sessions
+ *
* @author Mark Hobson <ma...@gmail.com>
* @version $Id: SessionsMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal sessions
*/
public class SessionsMojo
extends AbstractWarCatalinaMojo
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ShutdownMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ShutdownMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ShutdownMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ShutdownMojo.java Mon Oct 17 14:06:08 2011
@@ -19,7 +19,6 @@ package org.apache.tomcat.maven.plugin.t
* under the License.
*/
-import org.apache.catalina.LifecycleException;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.tomcat.maven.common.run.EmbeddedRegistry;
@@ -56,16 +55,16 @@ public class ShutdownMojo
*
* @throws MojoExecutionException if shutting down one or all servers failed
*/
- public void execute( )
+ public void execute()
throws MojoExecutionException
{
try
{
- EmbeddedRegistry.getInstance().shutdownAll( getLog( ) );
+ EmbeddedRegistry.getInstance().shutdownAll( getLog() );
}
catch ( Exception e )
{
- if (!skipErrorOnShutdown)
+ if ( !skipErrorOnShutdown )
{
throw new MojoExecutionException( messagesProvider.getMessage( "ShutdownMojo.shutdownError" ), e );
}
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/StartMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/StartMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/StartMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/StartMojo.java Mon Oct 17 14:06:08 2011
@@ -26,10 +26,10 @@ import java.io.IOException;
/**
* Start a WAR in Tomcat.
- *
- * @goal start
+ *
* @author Mark Hobson <ma...@gmail.com>
* @version $Id: StartMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal start
*/
public class StartMojo
extends AbstractWarCatalinaMojo
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/StopMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/StopMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/StopMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/StopMojo.java Mon Oct 17 14:06:08 2011
@@ -26,10 +26,10 @@ import java.io.IOException;
/**
* Stop a WAR in Tomcat.
- *
- * @goal stop
+ *
* @author Mark Hobson <ma...@gmail.com>
* @version $Id: StopMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal stop
*/
public class StopMojo
extends AbstractWarCatalinaMojo
Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/UndeployMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/UndeployMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/UndeployMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/UndeployMojo.java Mon Oct 17 14:06:08 2011
@@ -26,10 +26,10 @@ import java.io.IOException;
/**
* Undeploy a WAR from Tomcat.
- *
- * @goal undeploy
+ *
* @author Mark Hobson <ma...@gmail.com>
* @version $Id: UndeployMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal undeploy
*/
public class UndeployMojo
extends AbstractWarCatalinaMojo
@@ -40,7 +40,7 @@ public class UndeployMojo
/**
* Whether to fail the build if the web application cannot be undeployed.
- *
+ *
* @parameter expression = "${maven.tomcat.failOnError}" default-value = "true"
*/
private boolean failOnError;
@@ -56,7 +56,7 @@ public class UndeployMojo
protected void invokeManager()
throws MojoExecutionException, TomcatManagerException, IOException
{
- getLog().info( messagesProvider.getMessage( "UndeployMojo.undeployingApp", getDeployedURL( ) ) );
+ getLog().info( messagesProvider.getMessage( "UndeployMojo.undeployingApp", getDeployedURL() ) );
try
{
@@ -69,7 +69,7 @@ public class UndeployMojo
throw exception;
}
- getLog().warn( messagesProvider.getMessage( "UndeployMojo.undeployError", exception.getMessage( ) ) );
+ getLog().warn( messagesProvider.getMessage( "UndeployMojo.undeployError", exception.getMessage() ) );
}
}
}
Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractCatalinaMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractCatalinaMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractCatalinaMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractCatalinaMojo.java Mon Oct 17 14:06:08 2011
@@ -135,17 +135,17 @@ public abstract class AbstractCatalinaMo
/**
* {@inheritDoc}
*/
- public void execute( )
+ public void execute()
throws MojoExecutionException
{
try
{
- invokeManager( );
+ invokeManager();
}
catch ( TomcatManagerException exception )
{
throw new MojoExecutionException(
- messagesProvider.getMessage( "AbstractCatalinaMojo.managerError", exception.getMessage( ) ) );
+ messagesProvider.getMessage( "AbstractCatalinaMojo.managerError", exception.getMessage() ) );
}
catch ( IOException exception )
{
@@ -161,20 +161,23 @@ public abstract class AbstractCatalinaMo
/**
* Invokes Tomcat manager when this Mojo is executed.
*
- * @throws org.apache.maven.plugin.MojoExecutionException if there was a problem executing this goal
- * @throws org.apache.tomcat.maven.common.deployer.TomcatManagerException if the Tomcat manager request fails
- * @throws java.io.IOException if an i/o error occurs
+ * @throws org.apache.maven.plugin.MojoExecutionException
+ * if there was a problem executing this goal
+ * @throws org.apache.tomcat.maven.common.deployer.TomcatManagerException
+ * if the Tomcat manager request fails
+ * @throws java.io.IOException if an i/o error occurs
*/
- protected abstract void invokeManager( )
+ protected abstract void invokeManager()
throws MojoExecutionException, TomcatManagerException, IOException;
/**
* Gets the Tomcat manager wrapper object configured for this goal.
*
* @return the Tomcat manager wrapper object
- * @throws org.apache.maven.plugin.MojoExecutionException if there was a problem obtaining the authentication details
+ * @throws org.apache.maven.plugin.MojoExecutionException
+ * if there was a problem obtaining the authentication details
*/
- protected TomcatManager getManager( )
+ protected TomcatManager getManager()
throws MojoExecutionException
{
// lazily instantiate when config values have been injected
@@ -186,7 +189,7 @@ public abstract class AbstractCatalinaMo
if ( server == null )
{
// no server set, use defaults
- getLog( ).debug( messagesProvider.getMessage( "AbstractCatalinaMojo.defaultAuth" ) );
+ getLog().debug( messagesProvider.getMessage( "AbstractCatalinaMojo.defaultAuth" ) );
userName = DEFAULT_USERNAME;
password = DEFAULT_PASSWORD;
}
@@ -201,18 +204,18 @@ public abstract class AbstractCatalinaMo
}
// derive username
- userName = info.getUserName( );
+ userName = info.getUserName();
if ( userName == null )
{
- getLog( ).debug( messagesProvider.getMessage( "AbstractCatalinaMojo.defaultUserName" ) );
+ getLog().debug( messagesProvider.getMessage( "AbstractCatalinaMojo.defaultUserName" ) );
userName = DEFAULT_USERNAME;
}
// derive password
- password = info.getPassword( );
+ password = info.getPassword();
if ( password == null )
{
- getLog( ).debug( messagesProvider.getMessage( "AbstractCatalinaMojo.defaultPassword" ) );
+ getLog().debug( messagesProvider.getMessage( "AbstractCatalinaMojo.defaultPassword" ) );
password = DEFAULT_PASSWORD;
}
}
@@ -237,7 +240,7 @@ public abstract class AbstractCatalinaMo
*
* @return the full URL of the Tomcat manager instance to use
*/
- protected URL getURL( )
+ protected URL getURL()
{
return url;
}
@@ -247,7 +250,7 @@ public abstract class AbstractCatalinaMo
*
* @return the webapp context path to use
*/
- protected String getPath( )
+ protected String getPath()
{
return path;
}
@@ -258,10 +261,10 @@ public abstract class AbstractCatalinaMo
* @return the URL of the deployed webapp
* @throws java.net.MalformedURLException if the deployed webapp URL is invalid
*/
- protected URL getDeployedURL( )
+ protected URL getDeployedURL()
throws MalformedURLException
{
- return new URL( getURL( ), getPath( ) );
+ return new URL( getURL(), getPath() );
}
/**
@@ -273,9 +276,9 @@ public abstract class AbstractCatalinaMo
{
StringTokenizer tokenizer = new StringTokenizer( string, "\n\r" );
- while ( tokenizer.hasMoreTokens( ) )
+ while ( tokenizer.hasMoreTokens() )
{
- getLog( ).info( tokenizer.nextToken( ) );
+ getLog().info( tokenizer.nextToken() );
}
}
}
Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractWarCatalinaMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractWarCatalinaMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractWarCatalinaMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractWarCatalinaMojo.java Mon Oct 17 14:06:08 2011
@@ -23,7 +23,7 @@ import org.apache.maven.plugin.MojoExecu
/**
* Abstract goal that provides common configuration for Catalina-based goals.
- *
+ *
* @author Mark Hobson <ma...@gmail.com>
* @version $Id: AbstractWarCatalinaMojo.java 12852 2010-10-12 22:04:32Z thragor $
*/
@@ -36,7 +36,7 @@ public abstract class AbstractWarCatalin
/**
* The packaging of the Maven project that this goal operates upon.
- *
+ *
* @parameter expression = "${project.packaging}"
* @required
* @readonly
@@ -45,11 +45,12 @@ public abstract class AbstractWarCatalin
/**
* If set to true ignore if packaging of project is not 'war'.
- * @since 1.1
+ *
* @parameter expression="${tomcat.ignorePackaging}" default-value="false"
+ * @since 1.1
*/
private boolean ignorePackaging;
-
+
// ----------------------------------------------------------------------
// Mojo Implementation
// ----------------------------------------------------------------------
@@ -76,11 +77,11 @@ public abstract class AbstractWarCatalin
/**
* Gets whether this project uses WAR packaging.
- *
+ *
* @return whether this project uses WAR packaging
*/
protected boolean isWar()
{
- return "war".equals( packaging ) || ignorePackaging;
+ return "war".equals( packaging ) || ignorePackaging;
}
}
Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployMojo.java Mon Oct 17 14:06:08 2011
@@ -79,20 +79,20 @@ public abstract class AbstractDeployMojo
* {@inheritDoc}
*/
@Override
- public void invokeManager( )
+ public void invokeManager()
throws MojoExecutionException, TomcatManagerException, IOException
{
if ( "war".equals( mode ) )
{
- deployWar( );
+ deployWar();
}
else if ( "context".equals( mode ) )
{
- deployContext( );
+ deployContext();
}
else if ( "both".equals( mode ) )
{
- deployWarAndContext( );
+ deployWarAndContext();
}
else
{
@@ -105,14 +105,15 @@ public abstract class AbstractDeployMojo
*
* @return the Tomcat WAR file.
*/
- protected abstract File getWarFile( );
+ protected abstract File getWarFile();
/**
* Ensures that the Tomcat WAR file exists and is the correct type for the deployment mode.
*
- * @throws org.apache.maven.plugin.MojoExecutionException if the WAR file does not exist or is not the correct type for the deployment mode
+ * @throws org.apache.maven.plugin.MojoExecutionException
+ * if the WAR file does not exist or is not the correct type for the deployment mode
*/
- protected abstract void validateWarFile( )
+ protected abstract void validateWarFile()
throws MojoExecutionException;
/**
@@ -120,7 +121,7 @@ public abstract class AbstractDeployMojo
*
* @return the Tomcat context XML file.
*/
- protected File getContextFile( )
+ protected File getContextFile()
{
return contextFile;
}
@@ -128,15 +129,16 @@ public abstract class AbstractDeployMojo
/**
* Ensures that the Tomcat context XML file exists and is indeed a file.
*
- * @throws org.apache.maven.plugin.MojoExecutionException if the context file does not exist or is not a file
+ * @throws org.apache.maven.plugin.MojoExecutionException
+ * if the context file does not exist or is not a file
*/
- protected void validateContextFile( )
+ protected void validateContextFile()
throws MojoExecutionException
{
- if ( !contextFile.exists( ) || !contextFile.isFile( ) )
+ if ( !contextFile.exists() || !contextFile.isFile() )
{
throw new MojoExecutionException(
- messagesProvider.getMessage( "AbstractDeployMojo.missingContext", contextFile.getPath( ) ) );
+ messagesProvider.getMessage( "AbstractDeployMojo.missingContext", contextFile.getPath() ) );
}
}
@@ -145,7 +147,7 @@ public abstract class AbstractDeployMojo
*
* @return whether Tomcat should automatically undeploy webapps that already exist when deploying
*/
- protected boolean isUpdate( )
+ protected boolean isUpdate()
{
return update;
}
@@ -155,7 +157,7 @@ public abstract class AbstractDeployMojo
*
* @return the Tomcat webapp tag name to use
*/
- protected String getTag( )
+ protected String getTag()
{
return tag;
}
@@ -163,56 +165,62 @@ public abstract class AbstractDeployMojo
/**
* Deploys the WAR to Tomcat.
*
- * @throws org.apache.maven.plugin.MojoExecutionException if there was a problem locating the WAR
- * @throws org.apache.tomcat.maven.common.deployer.TomcatManagerException if the Tomcat manager request fails
- * @throws java.io.IOException if an i/o error occurs
+ * @throws org.apache.maven.plugin.MojoExecutionException
+ * if there was a problem locating the WAR
+ * @throws org.apache.tomcat.maven.common.deployer.TomcatManagerException
+ * if the Tomcat manager request fails
+ * @throws java.io.IOException if an i/o error occurs
*/
- protected void deployWar( )
+ protected void deployWar()
throws MojoExecutionException, TomcatManagerException, IOException
{
- validateWarFile( );
+ validateWarFile();
- getLog( ).info( messagesProvider.getMessage( "AbstractDeployMojo.deployingWar", getDeployedURL( ) ) );
+ getLog().info( messagesProvider.getMessage( "AbstractDeployMojo.deployingWar", getDeployedURL() ) );
- URL warURL = getWarFile( ).toURL( );
- log( getManager( ).deploy( getPath( ), warURL, isUpdate( ), getTag( ) ) );
+ URL warURL = getWarFile().toURL();
+ log( getManager().deploy( getPath(), warURL, isUpdate(), getTag() ) );
}
/**
* Deploys the context XML file to Tomcat.
*
- * @throws org.apache.maven.plugin.MojoExecutionException if there was a problem locating the context XML file
- * @throws org.apache.tomcat.maven.common.deployer.TomcatManagerException if the Tomcat manager request fails
- * @throws java.io.IOException if an i/o error occurs
+ * @throws org.apache.maven.plugin.MojoExecutionException
+ * if there was a problem locating the context XML file
+ * @throws org.apache.tomcat.maven.common.deployer.TomcatManagerException
+ * if the Tomcat manager request fails
+ * @throws java.io.IOException if an i/o error occurs
*/
- protected void deployContext( )
+ protected void deployContext()
throws MojoExecutionException, TomcatManagerException, IOException
{
- validateContextFile( );
+ validateContextFile();
- getLog( ).info( messagesProvider.getMessage( "AbstractDeployMojo.deployingContext", getDeployedURL( ) ) );
+ getLog().info( messagesProvider.getMessage( "AbstractDeployMojo.deployingContext", getDeployedURL() ) );
- URL contextURL = getContextFile( ).toURL( );
- log( getManager( ).deployContext( getPath( ), contextURL, isUpdate( ), getTag( ) ) );
+ URL contextURL = getContextFile().toURL();
+ log( getManager().deployContext( getPath(), contextURL, isUpdate(), getTag() ) );
}
/**
* Deploys the WAR and context XML file to Tomcat.
*
- * @throws org.apache.maven.plugin.MojoExecutionException if there was a problem locating either the WAR or the context XML file
- * @throws org.apache.tomcat.maven.common.deployer.TomcatManagerException if the Tomcat manager request fails
- * @throws java.io.IOException if an i/o error occurs
+ * @throws org.apache.maven.plugin.MojoExecutionException
+ * if there was a problem locating either the WAR or the context XML file
+ * @throws org.apache.tomcat.maven.common.deployer.TomcatManagerException
+ * if the Tomcat manager request fails
+ * @throws java.io.IOException if an i/o error occurs
*/
- protected void deployWarAndContext( )
+ protected void deployWarAndContext()
throws MojoExecutionException, TomcatManagerException, IOException
{
- validateWarFile( );
- validateContextFile( );
+ validateWarFile();
+ validateContextFile();
- getLog( ).info( messagesProvider.getMessage( "AbstractDeployMojo.deployingWarContext", getDeployedURL( ) ) );
+ getLog().info( messagesProvider.getMessage( "AbstractDeployMojo.deployingWarContext", getDeployedURL() ) );
- URL warURL = getWarFile( ).toURL( );
- URL contextURL = getContextFile( ).toURL( );
- log( getManager( ).deployContext( getPath( ), contextURL, warURL, isUpdate( ), getTag( ) ) );
+ URL warURL = getWarFile().toURL();
+ URL contextURL = getContextFile().toURL();
+ log( getManager().deployContext( getPath(), contextURL, warURL, isUpdate(), getTag() ) );
}
}
Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployWarMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployWarMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployWarMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployWarMojo.java Mon Oct 17 14:06:08 2011
@@ -54,7 +54,7 @@ public class AbstractDeployWarMojo
* {@inheritDoc}
*/
@Override
- protected File getWarFile( )
+ protected File getWarFile()
{
return warFile;
}
@@ -63,13 +63,13 @@ public class AbstractDeployWarMojo
* {@inheritDoc}
*/
@Override
- protected void validateWarFile( )
+ protected void validateWarFile()
throws MojoExecutionException
{
- if ( !warFile.exists( ) || !warFile.isFile( ) )
+ if ( !warFile.exists() || !warFile.isFile() )
{
throw new MojoExecutionException(
- messagesProvider.getMessage( "DeployMojo.missingWar", warFile.getPath( ) ) );
+ messagesProvider.getMessage( "DeployMojo.missingWar", warFile.getPath() ) );
}
}
@@ -77,13 +77,13 @@ public class AbstractDeployWarMojo
* {@inheritDoc}
*/
@Override
- protected void deployWar( )
+ protected void deployWar()
throws MojoExecutionException, TomcatManagerException, IOException
{
- validateWarFile( );
+ validateWarFile();
- getLog( ).info( messagesProvider.getMessage( "AbstractDeployMojo.deployingWar", getDeployedURL( ) ) );
+ getLog().info( messagesProvider.getMessage( "AbstractDeployMojo.deployingWar", getDeployedURL() ) );
- log( getManager( ).deploy( getPath( ), new FileInputStream( warFile ), isUpdate( ), getTag( ) ) );
+ log( getManager().deploy( getPath(), new FileInputStream( warFile ), isUpdate(), getTag() ) );
}
}
Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/DeployMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/DeployMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/DeployMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/DeployMojo.java Mon Oct 17 14:06:08 2011
@@ -21,11 +21,11 @@ package org.apache.tomcat.maven.plugin.t
/**
* Deploy a WAR to Tomcat.
- *
- * @goal deploy
- * @execute phase="package"
+ *
* @author Mark Hobson <ma...@gmail.com>
* @version $Id: DeployMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal deploy
+ * @execute phase="package"
*/
public class DeployMojo
extends AbstractDeployWarMojo
Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/DeployOnlyMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/DeployOnlyMojo.java?rev=1185186&r1=1185185&r2=1185186&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/DeployOnlyMojo.java (original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/DeployOnlyMojo.java Mon Oct 17 14:06:08 2011
@@ -21,10 +21,10 @@ package org.apache.tomcat.maven.plugin.t
/**
* Deploy a WAR to Tomcat witjout forking the package lifecycle
- *
- * @goal deploy-only
+ *
* @author olamy
* @version $Id: DeployOnlyMojo.java 12852 2010-10-12 22:04:32Z thragor $
+ * @goal deploy-only
* @since 1.0-alpha-2
*/
public class DeployOnlyMojo
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=1185186&r1=1185185&r2=1185186&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 Mon Oct 17 14:06:08 2011
@@ -22,7 +22,6 @@ import org.apache.commons.compress.archi
import org.apache.commons.compress.archivers.ArchiveOutputStream;
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
import org.apache.commons.compress.archivers.jar.JarArchiveEntry;
-import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.artifact.Artifact;
@@ -36,7 +35,6 @@ import org.apache.maven.plugin.MojoExecu
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
-import org.apache.maven.settings.MavenSettingsBuilder;
import org.apache.tomcat.maven.plugin.tomcat7.AbstractTomcat7Mojo;
import org.apache.tomcat.maven.runner.Tomcat7Runner;
import org.apache.tomcat.maven.runner.Tomcat7RunnerCli;
@@ -45,7 +43,6 @@ import org.codehaus.plexus.archiver.jar.
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -58,7 +55,6 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile;
/**
- *
* @author Olivier Lamy
* @since 2.0
*/
@@ -73,7 +69,7 @@ public abstract class AbstractExecWarMoj
* @readonly
*/
private Artifact projectArtifact;
-
+
/**
* The maven project.
*
@@ -82,7 +78,7 @@ public abstract class AbstractExecWarMoj
* @readonly
*/
protected MavenProject project;
-
+
/**
* @parameter default-value="${plugin.artifacts}"
* @required
@@ -123,7 +119,7 @@ public abstract class AbstractExecWarMoj
protected String path;
/**
- * @parameter
+ * @parameter
*/
protected List<WarRunDependency> warRunDependencies;
@@ -138,7 +134,7 @@ public abstract class AbstractExecWarMoj
* @component
*/
private ArtifactFactory artifactFactory;
-
+
/**
* Location of the local repository.
*
@@ -209,6 +205,7 @@ public abstract class AbstractExecWarMoj
/**
* list of extra dependencies to add in the standalone tomcat jar: your jdbc driver, mail.jar etc..
* <b>Those dependencies will be in root classloader.</b>
+ *
* @parameter
*/
private List<Dependency> extraDependencies;
@@ -224,10 +221,10 @@ public abstract class AbstractExecWarMoj
public void execute()
throws MojoExecutionException, MojoFailureException
{
-
+
//project.addAttachedArtifact( );
File warExecFile = new File( buildDirectory, finalName );
- if (warExecFile.exists())
+ if ( warExecFile.exists() )
{
warExecFile.delete();
}
@@ -259,11 +256,10 @@ public abstract class AbstractExecWarMoj
tmpPropertiesFileOutputStream = new FileOutputStream( tmpPropertiesFile );
execWarJar.getParentFile().mkdirs();
execWarJar.createNewFile();
- execWarJarOutputStream = new FileOutputStream( execWarJar );
+ execWarJarOutputStream = new FileOutputStream( execWarJar );
tmpManifestWriter = new PrintWriter( tmpManifestFile );
-
// store :
//* wars in the root: foo.war
//* tomcat jars
@@ -275,36 +271,37 @@ public abstract class AbstractExecWarMoj
//* optionnal: conf/ with usual tomcat configuration files
//* MANIFEST with Main-Class
- Properties properties = new Properties( );
+ Properties properties = new Properties();
properties.put( Tomcat7Runner.ENABLE_NAMING_KEY, Boolean.toString( enableNaming ) );
properties.put( Tomcat7Runner.ACCESS_LOG_VALVE_FORMAT_KEY, accessLogValveFormat );
- os =
- new ArchiveStreamFactory().createArchiveOutputStream( ArchiveStreamFactory.JAR, execWarJarOutputStream );
+ os = new ArchiveStreamFactory().createArchiveOutputStream( ArchiveStreamFactory.JAR,
+ execWarJarOutputStream );
if ( "war".equals( project.getPackaging() ) )
{
os.putArchiveEntry( new JarArchiveEntry( path + ".war" ) );
IOUtils.copy( new FileInputStream( projectArtifact.getFile() ), os );
os.closeArchiveEntry();
- properties.put( Tomcat7Runner.WARS_KEY , path + ".war|" + path );
+ properties.put( Tomcat7Runner.WARS_KEY, path + ".war|" + path );
}
-
-
- if ( "pom".equals( project.getPackaging() ) && ( warRunDependencies != null && !warRunDependencies.isEmpty() ) )
+ if ( "pom".equals( project.getPackaging() ) && ( warRunDependencies != null
+ && !warRunDependencies.isEmpty() ) )
{
- for (WarRunDependency warRunDependency : warRunDependencies )
+ for ( WarRunDependency warRunDependency : warRunDependencies )
{
if ( warRunDependency.dependency != null )
{
Dependency dependency = warRunDependency.dependency;
// String groupId, String artifactId, String version, String scope, String type
Artifact artifact =
- artifactFactory.createArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), dependency.getScope(), dependency.getType() );
-
- artifactResolver.resolve( artifact, this.remoteRepos , this.local );
+ artifactFactory.createArtifact( dependency.getGroupId(), dependency.getArtifactId(),
+ dependency.getVersion(), dependency.getScope(),
+ dependency.getType() );
+
+ artifactResolver.resolve( artifact, this.remoteRepos, this.local );
File warFile = artifact.getFile();
if ( warRunDependency.contextXml != null )
{
@@ -315,13 +312,16 @@ public abstract class AbstractExecWarMoj
os.closeArchiveEntry();
String propertyWarValue = properties.getProperty( Tomcat7Runner.WARS_KEY );
// FIXME check contextPath is not empty or at least only / for root app
- if (propertyWarValue != null )
+ if ( propertyWarValue != null )
{
- properties.put( Tomcat7Runner.WARS_KEY , propertyWarValue + ";" + artifact.getFile().getName() + "|" + warRunDependency.contextPath );
+ properties.put( Tomcat7Runner.WARS_KEY,
+ propertyWarValue + ";" + artifact.getFile().getName() + "|"
+ + warRunDependency.contextPath );
}
else
{
- properties.put( Tomcat7Runner.WARS_KEY , artifact.getFile().getName() + "|" + warRunDependency.contextPath );
+ properties.put( Tomcat7Runner.WARS_KEY,
+ artifact.getFile().getName() + "|" + warRunDependency.contextPath );
}
}
}
@@ -329,19 +329,18 @@ public abstract class AbstractExecWarMoj
// FIXME if no war has been added here we must stop with a human readable and user friendly error message
-
- if (serverXml != null && serverXml.exists() )
+ if ( serverXml != null && serverXml.exists() )
{
- os.putArchiveEntry( new JarArchiveEntry( "conf/server.xml") );
- IOUtils.copy( new FileInputStream(serverXml), os );
+ os.putArchiveEntry( new JarArchiveEntry( "conf/server.xml" ) );
+ IOUtils.copy( new FileInputStream( serverXml ), os );
os.closeArchiveEntry();
- properties.put(Tomcat7Runner.USE_SERVER_XML_KEY, Boolean.TRUE.toString() );
- } else
+ properties.put( Tomcat7Runner.USE_SERVER_XML_KEY, Boolean.TRUE.toString() );
+ }
+ else
{
- properties.put(Tomcat7Runner.USE_SERVER_XML_KEY, Boolean.FALSE.toString() );
+ properties.put( Tomcat7Runner.USE_SERVER_XML_KEY, Boolean.FALSE.toString() );
}
-
properties.store( tmpPropertiesFileOutputStream, "created by Apache Tomcat Maven plugin" );
tmpPropertiesFileOutputStream.flush();
@@ -350,15 +349,14 @@ public abstract class AbstractExecWarMoj
os.putArchiveEntry( new JarArchiveEntry( Tomcat7RunnerCli.STAND_ALONE_PROPERTIES_FILENAME ) );
IOUtils.copy( new FileInputStream( tmpPropertiesFile ), os );
os.closeArchiveEntry();
-
// add tomcat classes
- for (Artifact pluginArtifact : pluginArtifacts)
+ for ( Artifact pluginArtifact : pluginArtifacts )
{
- if ( StringUtils.equals( "org.apache.tomcat", pluginArtifact.getGroupId() )
- || StringUtils.equals( "org.apache.tomcat.embed", pluginArtifact.getGroupId() )
- || StringUtils.equals( "org.eclipse.jdt.core.compiler", pluginArtifact.getGroupId() )
- || StringUtils.equals( "commons-cli", pluginArtifact.getArtifactId() )
+ if ( StringUtils.equals( "org.apache.tomcat", pluginArtifact.getGroupId() ) || StringUtils.equals(
+ "org.apache.tomcat.embed", pluginArtifact.getGroupId() ) || StringUtils.equals(
+ "org.eclipse.jdt.core.compiler", pluginArtifact.getGroupId() ) || StringUtils.equals( "commons-cli",
+ pluginArtifact.getArtifactId() )
|| StringUtils.equals( "tomcat7-war-runner", pluginArtifact.getArtifactId() ) )
{
JarFile jarFile = new JarFile( pluginArtifact.getFile() );
@@ -366,7 +364,7 @@ public abstract class AbstractExecWarMoj
while ( jarEntries.hasMoreElements() )
{
JarEntry jarEntry = jarEntries.nextElement();
- InputStream jarEntryIs = jarFile.getInputStream(jarEntry);
+ InputStream jarEntryIs = jarFile.getInputStream( jarEntry );
os.putArchiveEntry( new JarArchiveEntry( jarEntry.getName() ) );
IOUtils.copy( jarEntryIs, os );
@@ -382,15 +380,17 @@ public abstract class AbstractExecWarMoj
{
// String groupId, String artifactId, String version, String scope, String type
Artifact artifact =
- artifactFactory.createArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), dependency.getScope(), dependency.getType() );
+ artifactFactory.createArtifact( dependency.getGroupId(), dependency.getArtifactId(),
+ dependency.getVersion(), dependency.getScope(),
+ dependency.getType() );
- artifactResolver.resolve( artifact, this.remoteRepos , this.local );
+ artifactResolver.resolve( artifact, this.remoteRepos, this.local );
JarFile jarFile = new JarFile( artifact.getFile() );
Enumeration<JarEntry> jarEntries = jarFile.entries();
while ( jarEntries.hasMoreElements() )
{
JarEntry jarEntry = jarEntries.nextElement();
- InputStream jarEntryIs = jarFile.getInputStream(jarEntry);
+ InputStream jarEntryIs = jarFile.getInputStream( jarEntry );
os.putArchiveEntry( new JarArchiveEntry( jarEntry.getName() ) );
IOUtils.copy( jarEntryIs, os );
@@ -399,10 +399,10 @@ public abstract class AbstractExecWarMoj
}
}
- Manifest manifest = new Manifest( );
+ Manifest manifest = new Manifest();
- Manifest.Attribute mainClassAtt = new Manifest.Attribute( );
- mainClassAtt.setName( "Main-Class");
+ Manifest.Attribute mainClassAtt = new Manifest.Attribute();
+ mainClassAtt.setName( "Main-Class" );
mainClassAtt.setValue( mainClass );
manifest.addConfiguredAttribute( mainClassAtt );
@@ -417,24 +417,31 @@ public abstract class AbstractExecWarMoj
if ( attachArtifact )
{
//MavenProject project, String artifactType, String artifactClassifier, File artifactFile
- projectHelper.attachArtifact( project, attachArtifactClassifierType, attachArtifactClassifier, execWarJar );
+ projectHelper.attachArtifact( project, attachArtifactClassifierType, attachArtifactClassifier,
+ execWarJar );
}
- } catch ( ManifestException e )
+ }
+ catch ( ManifestException e )
{
throw new MojoExecutionException( e.getMessage(), e );
- } catch ( IOException e )
+ }
+ catch ( IOException e )
{
throw new MojoExecutionException( e.getMessage(), e );
- } catch ( ArchiveException e )
+ }
+ catch ( ArchiveException e )
{
throw new MojoExecutionException( e.getMessage(), e );
- } catch ( ArtifactNotFoundException e )
+ }
+ catch ( ArtifactNotFoundException e )
{
throw new MojoExecutionException( e.getMessage(), e );
- } catch ( ArtifactResolutionException e )
+ }
+ catch ( ArtifactResolutionException e )
{
throw new MojoExecutionException( e.getMessage(), e );
- } finally
+ }
+ finally
{
IOUtils.closeQuietly( os );
IOUtils.closeQuietly( tmpManifestWriter );
@@ -444,7 +451,7 @@ public abstract class AbstractExecWarMoj
}
- private void addContextXmlToWar(File contextXmlFile, File warFile)
+ private void addContextXmlToWar( File contextXmlFile, File warFile )
throws IOException, ArchiveException
{
ArchiveOutputStream os = null;
@@ -452,12 +459,12 @@ public abstract class AbstractExecWarMoj
try
{
warOutputStream = new FileOutputStream( warFile );
- os =
- new ArchiveStreamFactory().createArchiveOutputStream( ArchiveStreamFactory.JAR, warOutputStream );
+ os = new ArchiveStreamFactory().createArchiveOutputStream( ArchiveStreamFactory.JAR, warOutputStream );
os.putArchiveEntry( new JarArchiveEntry( "META-INF/context.xml" ) );
IOUtils.copy( new FileInputStream( contextXmlFile ), os );
os.closeArchiveEntry();
- } finally
+ }
+ finally
{
IOUtils.closeQuietly( os );
IOUtils.closeQuietly( warOutputStream );
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org