forked from undertow-io/undertow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UNDERTOW-1757] Add support to Jakarta EE9
- Loading branch information
Showing
11 changed files
with
826 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ JBoss, Home of Professional Open Source. | ||
~ Copyright 2020 Red Hat, Inc., and individual contributors | ||
~ as indicated by the @author tags. | ||
~ | ||
~ Licensed 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. | ||
--> | ||
|
||
<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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.undertow</groupId> | ||
<artifactId>undertow-parent</artifactId> | ||
<version>2.2.1.Final</version> | ||
</parent> | ||
|
||
<groupId>io.undertow</groupId> | ||
<artifactId>undertow-jakartaee9</artifactId> | ||
<version>2.2.1.Final</version> | ||
|
||
<name>Undertow Jakarta EE9</name> | ||
|
||
<properties> | ||
<version.jakarta.servlet-api>5.0.0</version.jakarta.servlet-api> | ||
<version.jakarta.websocket-client-api>2.0.0</version.jakarta.websocket-client-api> | ||
</properties> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.jboss.logging</groupId> | ||
<artifactId>jboss-logging</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jboss.logging</groupId> | ||
<artifactId>jboss-logging-processor</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.undertow</groupId> | ||
<artifactId>undertow-examples</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.undertow</groupId> | ||
<artifactId>undertow-servlet</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.undertow</groupId> | ||
<artifactId>undertow-websockets-jsr</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.wildfly-extras</groupId> | ||
<artifactId>transformer-api</artifactId> | ||
<!-- <scope>runtime</scope> --> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.wildfly-extras</groupId> | ||
<artifactId>transformer-tools-api</artifactId> | ||
<!-- <scope>runtime</scope> --> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.wildfly-extras</groupId> | ||
<artifactId>asm-based-transformer</artifactId> | ||
<!-- <scope>runtime</scope> --> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.maven.shared</groupId> | ||
<artifactId>maven-invoker</artifactId> | ||
<version>3.0.1</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>${project.basedir}/src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>copy</goal> | ||
</goals> | ||
<configuration> | ||
<artifactItems> | ||
<!-- pom files --> | ||
<artifactItem> | ||
<groupId>io.undertow</groupId> | ||
<artifactId>undertow-servlet</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<overWrite>true</overWrite> | ||
<outputDirectory>${project.basedir}/target/input</outputDirectory> | ||
</artifactItem> | ||
<artifactItem> | ||
<groupId>io.undertow</groupId> | ||
<artifactId>undertow-examples</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<overWrite>true</overWrite> | ||
<outputDirectory>${project.basedir}/target/input</outputDirectory> | ||
</artifactItem> | ||
<artifactItem> | ||
<groupId>io.undertow</groupId> | ||
<artifactId>undertow-websockets-jsr</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<overWrite>true</overWrite> | ||
<outputDirectory>${project.basedir}/target/input</outputDirectory> | ||
</artifactItem> | ||
<!-- jar files --> | ||
<artifactItem> | ||
<groupId>io.undertow</groupId> | ||
<artifactId>undertow-servlet</artifactId> | ||
<version>${project.version}</version> | ||
<overWrite>true</overWrite> | ||
<outputDirectory>${project.basedir}/target/input</outputDirectory> | ||
</artifactItem> | ||
<artifactItem> | ||
<groupId>io.undertow</groupId> | ||
<artifactId>undertow-examples</artifactId> | ||
<version>${project.version}</version> | ||
<overWrite>true</overWrite> | ||
<outputDirectory>${project.basedir}/target/input</outputDirectory> | ||
</artifactItem> | ||
<artifactItem> | ||
<groupId>io.undertow</groupId> | ||
<artifactId>undertow-websockets-jsr</artifactId> | ||
<version>${project.version}</version> | ||
<overWrite>true</overWrite> | ||
<outputDirectory>${project.basedir}/target/input</outputDirectory> | ||
</artifactItem> | ||
</artifactItems> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>3.0.0</version> | ||
<executions> | ||
<execution> | ||
<id>transform-artifacts</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>java</goal> | ||
</goals> | ||
<configuration> | ||
<mainClass>io.undertow.jakartaee9.JakartaEE9Transformer</mainClass> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>install-artifacts</id> | ||
<phase>install</phase> | ||
<goals> | ||
<goal>java</goal> | ||
</goals> | ||
<configuration> | ||
<mainClass>io.undertow.jakartaee9.JakartaEE9Installer</mainClass> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>deploy-artifacts</id> | ||
<phase>deploy</phase> | ||
<goals> | ||
<goal>java</goal> | ||
</goals> | ||
<configuration> | ||
<mainClass>io.undertow.jakartaee9.JakartaEE9Deployer</mainClass> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<systemProperties> | ||
<systemProperty> | ||
<key>version.jakarta.servlet-api</key> | ||
<value>${version.jakarta.servlet-api}</value> | ||
</systemProperty> | ||
<systemProperty> | ||
<key>version.jakarta.websocket-client-api</key> | ||
<value>${version.jakarta.websocket-client-api}</value> | ||
</systemProperty> | ||
</systemProperties> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>3.0.0-M1</version> | ||
<executions> | ||
<!--<execution> | ||
<id>run</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>deploy-file</goal> | ||
</goals> | ||
</execution>--> | ||
</executions> | ||
<configuration> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
||
</project> |
44 changes: 44 additions & 0 deletions
44
jakartaee9/src/main/java/io/undertow/jakartaee9/ArtifactNameTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2020 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* Licensed 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. | ||
*/ | ||
package io.undertow.jakartaee9; | ||
|
||
import static io.undertow.jakartaee9.TransformConstants.VERSION_STRING; | ||
|
||
/** | ||
* Parses an Jakarta EE8 compatible artifact name and transforms it into the | ||
* equivalent Jakarta EE9 compatible counterpart. | ||
* | ||
* @author Flavia Rainone | ||
*/ | ||
class ArtifactNameTransformer { | ||
private static final String JAKARTA_EE9_SUFFIX = "-jakartaee9"; | ||
|
||
static String transformArtifactName(String fileName, String artifactType) { | ||
return getArtifactName(fileName, artifactType) + JAKARTA_EE9_SUFFIX; | ||
} | ||
|
||
static String transformArtifactFileName(String fileName, String artifactType) { | ||
final String outputFileSuffix = JAKARTA_EE9_SUFFIX + "-" + VERSION_STRING + "." + artifactType; | ||
return getArtifactName(fileName, artifactType) + outputFileSuffix; | ||
} | ||
|
||
static String getArtifactName(String fileName, String artifactType) { | ||
final String inputFileSuffix = "-" + VERSION_STRING + "." + artifactType; | ||
return fileName.substring(0, fileName.length() - inputFileSuffix.length()); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
jakartaee9/src/main/java/io/undertow/jakartaee9/JakartaEE9Deployer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2020 Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. | ||
* | ||
* Licensed 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. | ||
*/ | ||
package io.undertow.jakartaee9; | ||
|
||
import java.io.File; | ||
import java.io.FilenameFilter; | ||
import java.util.Collections; | ||
import java.util.Properties; | ||
|
||
import org.apache.maven.shared.invoker.DefaultInvocationRequest; | ||
import org.apache.maven.shared.invoker.DefaultInvoker; | ||
import org.apache.maven.shared.invoker.InvocationRequest; | ||
import org.apache.maven.shared.invoker.Invoker; | ||
import org.apache.maven.shared.invoker.MavenInvocationException; | ||
|
||
import static io.undertow.jakartaee9.TransformConstants.JAR_EXTENSION; | ||
import static io.undertow.jakartaee9.TransformConstants.OUTPUT_DIR; | ||
import static io.undertow.jakartaee9.TransformConstants.POM_EXTENSION; | ||
import static io.undertow.jakartaee9.UndertowJakartaEE9Logger.LOGGER; | ||
|
||
/** | ||
* Deploys Jakarta EE9 compatible artifacts. | ||
* | ||
* @author Flavia Rainone | ||
*/ | ||
public class JakartaEE9Deployer { | ||
|
||
public static void main (String[] args) | ||
throws MavenInvocationException { | ||
File[] pomFiles = OUTPUT_DIR.listFiles(new FilenameFilter() { | ||
@Override public boolean accept(File dir, String name) { | ||
return name.endsWith(POM_EXTENSION); | ||
} | ||
}); | ||
for (File pomFile : pomFiles) { | ||
final String pomFileName = pomFile.getAbsolutePath(); | ||
final String jarFileName = pomFile.getAbsolutePath().substring(0, pomFileName.length() - POM_EXTENSION | ||
.length()) + JAR_EXTENSION; | ||
LOGGER.installingFile(jarFileName, pomFile.getAbsolutePath()); | ||
|
||
final Properties properties = new Properties(); | ||
properties.put("file", jarFileName); | ||
properties.put("pomFile", pomFileName); | ||
|
||
final InvocationRequest request = new DefaultInvocationRequest(); | ||
request.setGoals(Collections.singletonList("deploy:deploy-file")); | ||
request.setProperties(properties); | ||
Invoker invoker = new DefaultInvoker(); | ||
invoker.execute( request ); | ||
} | ||
} | ||
} |
Oops, something went wrong.