Skip to content

Initial suport for Tomact9 - Tc9.x #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d1223db
Update maven plugin version - New version support Java8 lambda
poolborges Oct 12, 2018
efbaa88
poolborges Oct 12, 2018
b3cc38a
Add support for Tomcat9.x
poolborges Oct 12, 2018
2f482af
Merge branch 'trunk' into tc9.x
poolborges Feb 29, 2020
52efbfb
Fix maven-resources-plugin escapeString usage
karlvr Apr 21, 2020
7f26908
Fix Tomcat 9 configuration
karlvr Apr 21, 2020
d3b3280
Upgrade to Tomcat 9.0.34
karlvr Apr 21, 2020
a33c8f5
AbstractRunMojo: log which context file is being used
karlvr Apr 21, 2020
92154ae
RunMojo: only apply the /WEB-INF/classes workaround to the war’s buil…
karlvr Apr 21, 2020
778ffb3
RunMojo: debug logging for resource sets
karlvr Apr 21, 2020
d4b5e4e
RunMojo: remove temporary debugging output
karlvr Apr 21, 2020
f047942
Set the headless system property by default
karlvr Apr 24, 2020
0e37184
Tomcat 9: Build products should be considered before jars
karlvr Apr 24, 2020
d7447f7
Tomcat 9: static web resources should be loaded as static only
karlvr Apr 24, 2020
11aac45
Merge pull request #1 from karlvr/tc9.x
poolborges May 2, 2020
bea620d
Merge pull request #1 from poolborges/tc9.x
gilbertoca Oct 14, 2024
a59722f
Update AbstractRunMojo.java
gilbertoca Oct 14, 2024
17dd429
Merge pull request #2 from gilbertoca/gilbertoca-patch-1
gilbertoca Oct 14, 2024
69f0d4d
Update maven-compiler-plugin to 3.8.1
gilbertoca Oct 15, 2024
8ad238e
only add the target/classes resource if it exists
gilbertoca Oct 16, 2024
32023b0
Upgrade to new tomcats
gilbertoca Oct 16, 2024
4b464ad
More recent Tomcat 7,8 and 9 versions
gilbertoca Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
<maven.compiler.target>1.7</maven.compiler.target>
<mavenVersion>2.2.1</mavenVersion>


<mavenPluginPluginVersion>3.6.0</mavenPluginPluginVersion>

<!-- Test settings -->
<maven.test.redirectTestOutputToFile>false</maven.test.redirectTestOutputToFile>
<surefire.version>2.22.1</surefire.version>
Expand All @@ -55,7 +57,6 @@
<it.sleep.time>2000</it.sleep.time>
<verifier.maven.debug>false</verifier.maven.debug>
<verifier.debugJvm>false</verifier.debugJvm>
<maven.resources.escapeString>\</maven.resources.escapeString>
<distributionReleaseUrl>https://repository.apache.org/service/local/staging/deploy/maven2</distributionReleaseUrl>

<distributionSnapshotsUrl>https://repository.apache.org/content/repositories/snapshots</distributionSnapshotsUrl>
Expand All @@ -73,8 +74,8 @@
<its.ajp.port>2001</its.ajp.port>
<!-- server port for it tests -->
<its.server.port>2008</its.server.port>
<tomcat7Version>7.0.59</tomcat7Version>
<tomcat8Version>8.0.14</tomcat8Version>
<tomcat7Version>7.0.109</tomcat7Version>
<tomcat8Version>8.5.100</tomcat8Version>

<!-- to prevent isssues with last apache parent pom -->
<arguments />
Expand Down Expand Up @@ -324,6 +325,8 @@
<module>tomcat7-maven-plugin</module>
<module>tomcat8-war-runner</module>
<module>tomcat8-maven-plugin</module>
<module>tomcat9-war-runner</module>
<module>tomcat9-maven-plugin</module>
<module>tomcat-maven-archetype</module>
</modules>

Expand Down Expand Up @@ -678,7 +681,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>3.8.1</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<source>${maven.compiler.source}</source>
Expand Down Expand Up @@ -747,7 +750,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<version>3.3.1</version>
<configuration>
<escapeString>\</escapeString>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -774,6 +780,7 @@
<exclude>DEPENDENCIES</exclude>
<exclude>README.txt</exclude>
<exclude>*.sh</exclude>
<exclude>*.log</exclude>
<exclude>.git/**</exclude>
<exclude>.idea/**</exclude>
<exclude>out/**</exclude>
Expand Down
2 changes: 1 addition & 1 deletion tomcat-maven-archetype/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<name>Apache Tomcat Maven Plugin :: Archetype</name>

<properties>
<archetypeVersion>2.2</archetypeVersion>
<archetypeVersion>3.1.2</archetypeVersion>
<tomcatPluginVersion>${project.version}</tomcatPluginVersion>
<archetypeItGoalsBatch>clean,pre-integration-test</archetypeItGoalsBatch>
<archetypeItGoals>clean,install</archetypeItGoals>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,17 @@
<artifactId>tomcat-jsp-api</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
specific language governing permissions and limitations
under the License.
-->
<Context path="/"/>
<Context path=""/>
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.8.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
Expand Down
1 change: 0 additions & 1 deletion tomcat-maven-plugin-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<!-- The time to wait between startup and shutdown of tomcat. Realized by a test which waits for the specified
time. -->
<it.sleep.time>2000</it.sleep.time>
<maven.resources.escapeString>\</maven.resources.escapeString>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,11 +725,11 @@ else if ( defaultContextFile.exists() )
}

// https://issues.apache.org/jira/browse/MTOMCAT-255
if(context instanceof StandardContext)
if(context instanceof StandardContext && new File(project.getBuild().getOutputDirectory()).exists())
{
((StandardContext) context).setAddWebinfClassesResources(true);
((StandardContext) context).setAliases( "/WEB-INF/classes=" + project.getBuild().getOutputDirectory());
}
((StandardContext) context).setAddWebinfClassesResources(true);
((StandardContext) context).setAliases("/WEB-INF/classes=" + project.getBuild().getOutputDirectory());
}

return context;

Expand Down
6 changes: 3 additions & 3 deletions tomcat8-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,18 @@
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<version>${tomcat8Version}</version>
<version>8.5.57</version>
</dependency>

<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-logging-juli</artifactId>
<version>${tomcat8Version}</version>
<version>8.0.14</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-logging-log4j</artifactId>
<version>${tomcat8Version}</version>
<version>8.0.14</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -813,13 +813,13 @@ 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() )
{
return new FileResource( this, this.webAppPath, file, true );
return new FileResource( this, this.webAppPath, file, true, null );
}
WebResource webResource = super.getResource( path );
return webResource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@

import org.apache.catalina.Context;
import org.apache.catalina.WebResource;
import org.apache.catalina.WebResourceRoot;
import org.apache.catalina.WebResourceSet;
import org.apache.catalina.loader.WebappClassLoaderBase;
import org.apache.catalina.loader.WebappLoader;
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;
Expand Down Expand Up @@ -479,18 +478,16 @@ private WebResource urlToWebResource( URL url, String path )
jarFile = new JarFile( filePath );

JarEntry jarEntry = jarFile.getJarEntry( StringUtils.removeStart( path, "/" ) );
final JarResourceSet jarResourceSet = new JarResourceSet(this, getPath(), jarFile.getName(), path);

return new JarResource( this, //
return new JarResource( jarResourceSet, //
getPath(), //
filePath, //
url.getPath().substring( 0, idx ), //
jarEntry, //
"", //
null );
jarEntry);
}
else
{
return new FileResource( this, webAppPath, new File( url.getFile() ), true );
return new FileResource( this, webAppPath, new File( url.getFile() ), true, null );
}

}
Expand Down Expand Up @@ -537,18 +534,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" ) )
Expand All @@ -569,13 +566,11 @@ public WebResource getResource( String path )
(JarEntry) jarFile.getEntry( StringUtils.removeStart( path, "/" ) );
if ( jarEntry != null )
{
return new JarResource( context.getResources(), //
final JarResourceSet jarResourceSet = new JarResourceSet(context.getResources(), getPath(), jarFile.getName(), path);
return new JarResource( jarResourceSet, //
getPath(), //
jarFile.getName(), //
jar.toURI().toString(), //
jarEntry, //
path, //
jarFile.getManifest() );
jarEntry);
}
}
catch ( IOException e )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Adjust Tomcat Version
<project>
[...]
<properties>
<tomcat.version>7.0.50</tomcat.version>
<tomcat.version>8.5.100</tomcat.version>
[...]
</properties>
[...]
Expand Down
Loading