diff --git a/common-tomcat-maven-plugin/pom.xml b/common-tomcat-maven-plugin/pom.xml
index ddd6f943..477da174 100644
--- a/common-tomcat-maven-plugin/pom.xml
+++ b/common-tomcat-maven-plugin/pom.xml
@@ -24,7 +24,7 @@
tomcat-maven-plugin
org.apache.tomcat.maven
- 3.0-SNAPSHOT
+ 3.0-SNAPSHOT-context
common-tomcat-maven-plugin
Apache Tomcat Maven Plugin :: Common API
diff --git a/pom.xml b/pom.xml
index 3bcf3ceb..3ccdbd61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
tomcat-maven-plugin
pom
Apache Tomcat Maven Plugin
- 3.0-SNAPSHOT
+ 3.0-SNAPSHOT-context
The Tomcat Maven Plugin provides goals to manipulate WAR projects within the Tomcat servlet
container.
@@ -41,8 +41,8 @@
UTF-8
- 1.5
- 1.5
+ 1.8
+ 1.8
2.2.1
3.2
@@ -73,8 +73,8 @@
2001
2008
- 7.0.59
- 8.0.14
+ 7.0.62
+ 8.5.20
@@ -83,6 +83,7 @@
file://${tomcat-maven.siteFilePath}
${user.home}/tomcat-maven-plugin-${project.version}-content
+ 8.5.20
@@ -325,7 +326,7 @@
tomcat7-maven-plugin
tomcat8-war-runner
tomcat8-maven-plugin
- tomcat-maven-archetype
+
@@ -467,7 +468,7 @@
tomcat7-war-runner
${project.version}
-
+
org.apache.tomcat.maven
tomcat8-war-runner
@@ -786,6 +787,7 @@
.extract/**
*.patch
**/access_log.*
+ tomcat-maven-archetype/**
@@ -847,6 +849,7 @@
+
+
+ central
+ plugins-release
+ http://poisson.jalios.net:8081/artifactory/plugins-release-local
+
+
+ snapshots
+ plugins-snapshot
+ http://poisson.jalios.net:8081/artifactory/plugins-snapshot-local
+
diff --git a/tomcat-maven-archetype/pom.xml b/tomcat-maven-archetype/pom.xml
index 128680b0..422b9c4f 100644
--- a/tomcat-maven-archetype/pom.xml
+++ b/tomcat-maven-archetype/pom.xml
@@ -23,7 +23,7 @@
org.apache.tomcat.maven
tomcat-maven-plugin
- 3.0-SNAPSHOT
+ 3.0-SNAPSHOT-context
../pom.xml
diff --git a/tomcat-maven-plugin-it/pom.xml b/tomcat-maven-plugin-it/pom.xml
index 7569339b..a257f1e1 100644
--- a/tomcat-maven-plugin-it/pom.xml
+++ b/tomcat-maven-plugin-it/pom.xml
@@ -22,7 +22,7 @@
org.apache.tomcat.maven
tomcat-maven-plugin
- 3.0-SNAPSHOT
+ 3.0-SNAPSHOT-context
4.0.0
diff --git a/tomcat6-maven-plugin/pom.xml b/tomcat6-maven-plugin/pom.xml
index 2b84d418..8d12cec6 100644
--- a/tomcat6-maven-plugin/pom.xml
+++ b/tomcat6-maven-plugin/pom.xml
@@ -21,7 +21,7 @@
org.apache.tomcat.maven
tomcat-maven-plugin
- 3.0-SNAPSHOT
+ 3.0-SNAPSHOT-context
../pom.xml
diff --git a/tomcat7-maven-plugin/pom.xml b/tomcat7-maven-plugin/pom.xml
index 8bf9d293..dac75a46 100644
--- a/tomcat7-maven-plugin/pom.xml
+++ b/tomcat7-maven-plugin/pom.xml
@@ -23,7 +23,7 @@
tomcat-maven-plugin
org.apache.tomcat.maven
- 3.0-SNAPSHOT
+ 3.0-SNAPSHOT-context
tomcat7-maven-plugin
maven-plugin
diff --git a/tomcat7-maven-plugin/src/site/apt/adjust-embedded-tomcat-version.apt.vm b/tomcat7-maven-plugin/src/site/apt/adjust-embedded-tomcat-version.apt.vm
index 7123565c..1a167eca 100644
--- a/tomcat7-maven-plugin/src/site/apt/adjust-embedded-tomcat-version.apt.vm
+++ b/tomcat7-maven-plugin/src/site/apt/adjust-embedded-tomcat-version.apt.vm
@@ -35,7 +35,7 @@ Adjust Tomcat Version
[...]
- 7.0.50
+ 7.0.62
[...]
[...]
diff --git a/tomcat7-war-runner/pom.xml b/tomcat7-war-runner/pom.xml
index 3ba1ac2f..b503a965 100644
--- a/tomcat7-war-runner/pom.xml
+++ b/tomcat7-war-runner/pom.xml
@@ -23,10 +23,10 @@
tomcat-maven-plugin
org.apache.tomcat.maven
- 3.0-SNAPSHOT
+ 3.0-SNAPSHOT-context
tomcat7-war-runner
- 3.0-SNAPSHOT
+ 3.0-SNAPSHOT-context
Apache Tomcat Maven Plugin :: Tomcat 7.x War Runner
diff --git a/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java b/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
index 59adea2f..feb41147 100644
--- a/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
+++ b/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
@@ -97,6 +97,8 @@ public class Tomcat7Runner
public int ajpPort;
+ public String wars;
+
public String serverXmlPath;
public Properties runtimeProperties;
@@ -610,7 +612,6 @@ protected void extract()
}
- String wars = runtimeProperties.getProperty( WARS_KEY );
populateWebAppWarPerContext( wars );
for ( Map.Entry entry : webappWarPerContext.entrySet() )
diff --git a/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7RunnerCli.java b/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7RunnerCli.java
index 560572c3..1eb4b51c 100644
--- a/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7RunnerCli.java
+++ b/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7RunnerCli.java
@@ -62,6 +62,10 @@ public class Tomcat7RunnerCli
OptionBuilder.withArgName( "serverXmlPath" ).hasArg().withDescription( "server.xml to use, optional" ).create(
"serverXmlPath" );
+ static Option path =
+ OptionBuilder.withArgName( "contextPath" ).hasArg().withDescription( "custom deployment context path, optional" ).create(
+ "path" );
+
static Option resetExtract =
OptionBuilder.withArgName( "resetExtract" ).withDescription( "clean previous extract directory" ).create(
"resetExtract" );
@@ -114,6 +118,7 @@ public class Tomcat7RunnerCli
.addOption( help ) //
.addOption( debug ) //
.addOption( sysProps ) //
+ .addOption( path ) //
.addOption( httpProtocol ) //
.addOption( clientAuth ) //
.addOption( keyAlias ) //
@@ -208,6 +213,19 @@ public static void main( String[] args )
tomcat7Runner.httpProtocol = line.getOptionValue( httpProtocol.getOpt() );
}
+ tomcat7Runner.wars = tomcat7Runner.runtimeProperties.getProperty( Tomcat7Runner.WARS_KEY );
+ if( line.hasOption( path.getOpt() ) ) {
+ String pathOption = line.getOptionValue( path.getOpt() );
+ if ( pathOption != null && !pathOption.isEmpty() ) {
+ String[] split = tomcat7Runner.wars.split("\\|");
+ if(split.length != 2) {
+ System.err.println( "JAR contains more than one WAR to deploy. Cannot set custom deploy path." );
+ System.exit( 1 );
+ }
+ tomcat7Runner.wars = split[0] + "|" + pathOption;
+ }
+ }
+
if ( line.hasOption( sysProps.getOpt() ) )
{
Properties systemProperties = line.getOptionProperties( sysProps.getOpt() );
diff --git a/tomcat8-maven-plugin/pom.xml b/tomcat8-maven-plugin/pom.xml
index 6bb68859..56472c6f 100644
--- a/tomcat8-maven-plugin/pom.xml
+++ b/tomcat8-maven-plugin/pom.xml
@@ -23,7 +23,7 @@
tomcat-maven-plugin
org.apache.tomcat.maven
- 3.0-SNAPSHOT
+ 3.0-SNAPSHOT-context
tomcat8-maven-plugin
maven-plugin
@@ -41,7 +41,7 @@
org.apache.tomcat.embed
tomcat-embed-core
- ${tomcat8Version}
+ ${tomcatEmbed8Version}
org.apache.tomcat
@@ -134,16 +134,6 @@
${tomcat8Version}
-
- org.apache.tomcat.embed
- tomcat-embed-logging-juli
- ${tomcat8Version}
-
-
- org.apache.tomcat.embed
- tomcat-embed-logging-log4j
- ${tomcat8Version}
-
org.eclipse.jdt.core.compiler
diff --git a/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/AbstractRunMojo.java b/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/AbstractRunMojo.java
index 237d6454..d233de8b 100644
--- a/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/AbstractRunMojo.java
+++ b/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/AbstractRunMojo.java
@@ -793,6 +793,8 @@ protected static class MyDirContext
String buildOutputDirectory;
String webAppPath;
+
+ File webAppFile;
WebResourceSet webResourceSet;
@@ -803,6 +805,7 @@ protected static class MyDirContext
this.buildOutputDirectory = buildOutputDirectory;
this.webAppPath = webAppPath;
+ this.webAppFile = new File(webAppPath);
this.log = log;
}
@@ -813,17 +816,21 @@ public WebResource getResource( String path )
log.debug( "MyDirContext#getResource: " + path );
if ( "/WEB-INF/classes".equals( path ) )
{
- return new FileResource( this, this.webAppPath, new File( this.buildOutputDirectory ), true );
+ return new FileResource( this, this.webAppPath, new File( this.buildOutputDirectory ), true, null );
}
File file = new File( path );
- if ( file.exists() )
+ if ( file.exists() && isRelativeToWebAppPath(file) )
{
- return new FileResource( this, this.webAppPath, file, true );
+ return new FileResource( this, this.webAppPath, file, true, null );
}
WebResource webResource = super.getResource( path );
return webResource;
}
+
+ private boolean isRelativeToWebAppPath(File file){
+ return file != null && file.toPath().startsWith(webAppFile.toPath());
+ }
@Override
diff --git a/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/RunMojo.java b/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/RunMojo.java
index e141ef4e..f972ddd4 100644
--- a/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/RunMojo.java
+++ b/tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/run/RunMojo.java
@@ -24,10 +24,12 @@
import org.apache.catalina.WebResourceSet;
import org.apache.catalina.loader.WebappClassLoaderBase;
import org.apache.catalina.loader.WebappLoader;
+import org.apache.catalina.webresources.AbstractArchiveResourceSet;
import org.apache.catalina.webresources.EmptyResource;
import org.apache.catalina.webresources.FileResource;
import org.apache.catalina.webresources.FileResourceSet;
import org.apache.catalina.webresources.JarResource;
+import org.apache.catalina.webresources.JarResourceSet;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
@@ -476,25 +478,15 @@ private WebResource urlToWebResource( URL url, String path )
{
String filePath = StringUtils.removeStart( url.getFile().substring( 0, idx ), "file:" );
- jarFile = new JarFile( filePath );
-
- JarEntry jarEntry = jarFile.getJarEntry( StringUtils.removeStart( path, "/" ) );
-
- return new JarResource( this, //
- getPath(), //
- filePath, //
- url.getPath().substring( 0, idx ), //
- jarEntry, //
- "", //
- null );
+ return new JarResourceSet(this,webAppPath,filePath, null).getResource(StringUtils.removeStart( path, "/" ));
}
else
{
- return new FileResource( this, webAppPath, new File( url.getFile() ), true );
+ return new FileResource( this, webAppPath, new File( url.getFile() ), true, null );
}
}
- catch ( IOException e )
+ catch ( IllegalArgumentException e )
{
throw new RuntimeException( e.getMessage(), e );
}
@@ -537,18 +529,18 @@ public WebResource getResource( String path )
if ( StringUtils.startsWithIgnoreCase( path, "/WEB-INF/LIB" ) )
{
File file = new File( StringUtils.removeStartIgnoreCase( path, "/WEB-INF/LIB" ) );
- return new FileResource( context.getResources(), getPath(), file, true );
+ return new FileResource( context.getResources(), getPath(), file, true, null);
}
if ( StringUtils.equalsIgnoreCase( path, "/WEB-INF/classes" ) )
{
return new FileResource( context.getResources(), getPath(),
- new File( project.getBuild().getOutputDirectory() ), true );
+ new File( project.getBuild().getOutputDirectory() ), true, null );
}
File file = new File( project.getBuild().getOutputDirectory(), path );
if ( file.exists() )
{
- return new FileResource( context.getResources(), getPath(), file, true );
+ return new FileResource( context.getResources(), getPath(), file, true, null );
}
//if ( StringUtils.endsWith( path, ".class" ) )
@@ -564,21 +556,9 @@ public WebResource getResource( String path )
try
{
- JarFile jarFile = new JarFile( jar );
- JarEntry jarEntry =
- (JarEntry) jarFile.getEntry( StringUtils.removeStart( path, "/" ) );
- if ( jarEntry != null )
- {
- return new JarResource( context.getResources(), //
- getPath(), //
- jarFile.getName(), //
- jar.toURI().toString(), //
- jarEntry, //
- path, //
- jarFile.getManifest() );
- }
+ return new JarResourceSet(context.getResources(),getPath(),jar.toURI().toString(), null).getResource(StringUtils.removeStart( path, "/" ));
}
- catch ( IOException e )
+ catch ( IllegalArgumentException e )
{
getLog().debug( "skip error building jar file: " + e.getMessage(), e );
}
diff --git a/tomcat8-maven-plugin/src/site/apt/adjust-embedded-tomcat-version.apt.vm b/tomcat8-maven-plugin/src/site/apt/adjust-embedded-tomcat-version.apt.vm
index 02f0e8b8..12c70698 100644
--- a/tomcat8-maven-plugin/src/site/apt/adjust-embedded-tomcat-version.apt.vm
+++ b/tomcat8-maven-plugin/src/site/apt/adjust-embedded-tomcat-version.apt.vm
@@ -35,7 +35,7 @@ Adjust Tomcat Version
[...]
- 7.0.50
+ 7.0.62
[...]
[...]
diff --git a/tomcat8-war-runner/pom.xml b/tomcat8-war-runner/pom.xml
index ca580c65..9e20d304 100644
--- a/tomcat8-war-runner/pom.xml
+++ b/tomcat8-war-runner/pom.xml
@@ -23,10 +23,10 @@
tomcat-maven-plugin
org.apache.tomcat.maven
- 3.0-SNAPSHOT
+ 3.0-SNAPSHOT-context
tomcat8-war-runner
- 3.0-SNAPSHOT
+ 3.0-SNAPSHOT-context
Apache Tomcat Maven Plugin :: Tomcat 8.x War Runner
diff --git a/tomcat8-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat8Runner.java b/tomcat8-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat8Runner.java
index 0ccd4a23..0cb61e87 100644
--- a/tomcat8-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat8Runner.java
+++ b/tomcat8-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat8Runner.java
@@ -91,6 +91,8 @@ public class Tomcat8Runner
public int ajpPort;
+ public String wars;
+
public String serverXmlPath;
public Properties runtimeProperties;
@@ -214,7 +216,6 @@ public File run()
}
else
{
- String wars = runtimeProperties.getProperty( WARS_KEY );
populateWebAppWarPerContext( wars );
}
}
@@ -554,7 +555,6 @@ protected void extract()
}
- String wars = runtimeProperties.getProperty( WARS_KEY );
populateWebAppWarPerContext( wars );
for ( Map.Entry entry : webappWarPerContext.entrySet() )
diff --git a/tomcat8-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat8RunnerCli.java b/tomcat8-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat8RunnerCli.java
index 527e8fac..7977736e 100644
--- a/tomcat8-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat8RunnerCli.java
+++ b/tomcat8-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat8RunnerCli.java
@@ -59,6 +59,10 @@ public class Tomcat8RunnerCli
OptionBuilder.withArgName( "serverXmlPath" ).hasArg().withDescription( "server.xml to use, optional" ).create(
"serverXmlPath" );
+ static Option path =
+ OptionBuilder.withArgName( "contextPath" ).hasArg().withDescription( "custom deployment context path, optional" ).create(
+ "path" );
+
static Option resetExtract =
OptionBuilder.withArgName( "resetExtract" ).withDescription( "clean previous extract directory" ).create(
"resetExtract" );
@@ -105,7 +109,8 @@ public class Tomcat8RunnerCli
.addOption( resetExtract ) //
.addOption( help ) //
.addOption( debug ) //
- .addOption( sysProps ) //
+ .addOption( sysProps )
+ .addOption(path)
.addOption( httpProtocol ) //
.addOption( clientAuth ) //
.addOption( keyAlias ) //
@@ -194,6 +199,19 @@ public static void main( String[] args )
tomcat8Runner.httpProtocol = line.getOptionValue( httpProtocol.getOpt() );
}
+ tomcat8Runner.wars = tomcat8Runner.runtimeProperties.getProperty( Tomcat8Runner.WARS_KEY );
+ if( line.hasOption( path.getOpt() ) ) {
+ String pathOption = line.getOptionValue( path.getOpt() );
+ if ( pathOption != null && !pathOption.isEmpty() ) {
+ String[] split = tomcat8Runner.wars.split("\\|");
+ if(split.length != 2) {
+ System.err.println( "JAR contains more than one WAR to deploy. Cannot set custom deploy path." );
+ System.exit( 1 );
+ }
+ tomcat8Runner.wars = split[0] + "|" + pathOption;
+ }
+ }
+
if ( line.hasOption( sysProps.getOpt() ) )
{
Properties systemProperties = line.getOptionProperties( sysProps.getOpt() );