Issue #9463 NPE in ee10 maven plugin startup (#9475)

* Issue #9463 NPE in ee10 maven plugin startup
This commit is contained in:
Jan Bartel 2023-03-10 00:34:31 +11:00 committed by GitHub
parent 3ac49c8d65
commit 9f9868b754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 392 additions and 5 deletions

View File

@ -0,0 +1,2 @@
invoker.goals = verify -V -e
#test-compile failsafe:integration-test

View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>org.eclipse.jetty.ee10.its</groupId>
<artifactId>it-parent-pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jetty.ee10.its.jetty-combinedresource-it</groupId>
<artifactId>jetty-simple-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>EE10 :: Webapp with multiple base resources</name>
<properties>
<jetty.port.file>${project.build.directory}/jetty-combinedresource-port.txt</jetty.port.file>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-maven-plugin</artifactId>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<jetty.port.file>${jetty.port.file}</jetty.port.file>
<maven.it.name>${project.groupId}:${project.artifactId}</maven.it.name>
<contentCheck>BLAH</contentCheck>
<pathToCheck>/blah.html</pathToCheck>
</systemPropertyVariables>
<dependenciesToScan>
<dependency>org.eclipse.jetty.ee10:jetty-ee10-maven-plugin</dependency>
</dependenciesToScan>
<includes>
<include>**/*TestGetContent*</include>
</includes>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-maven-plugin</artifactId>
<executions>
<execution>
<id>start-jetty</id>
<phase>test-compile</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<supportedPackagings>
<supportedPackaging>pom</supportedPackaging>
</supportedPackagings>
<webApp>
<resourceBases>
<resourceBase>${project.basedir}/public</resourceBase>
<resourceBase>${project.basedir}/src/main/webapp</resourceBase>
</resourceBases>
</webApp>
<systemProperties>
<jetty.port.file>${jetty.port.file}</jetty.port.file>
</systemProperties>
<jettyXmls>
<jettyXml>${basedir}/src/config/jetty.xml</jettyXml>
</jettyXmls>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
File buildLog = new File( basedir, 'build.log' )
assert buildLog.text.contains( 'Started Server' )
assert buildLog.text.contains( 'Running org.eclipse.jetty.ee10.maven.plugin.it.IntegrationTestGetContent')
assert buildLog.text.contains( 'contentCheck')

View File

@ -0,0 +1,40 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<Set name="secureScheme">https</Set>
<Set name="securePort"><Property name="jetty.secure.port" default="8443" /></Set>
<Set name="outputBufferSize">32768</Set>
<Set name="requestHeaderSize">8192</Set>
<Set name="responseHeaderSize">8192</Set>
<Set name="headerCacheSize">1024</Set>
</New>
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server" /></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref refid="httpConfig" /></Arg>
</New>
</Item>
</Array>
</Arg>
<Call name="addEventListener">
<Arg>
<New class="org.eclipse.jetty.ee10.maven.plugin.ServerConnectorListener">
<Set name="fileName"><Property name="jetty.port.file" default="port.txt"/></Set>
</New>
</Arg>
</Call>
<Set name="host" property="jetty.host"/>
<Set name="port" property="jetty.port"/>
<Set name="idleTimeout">30000</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_1.xsd"
metadata-complete="true"
version="3.1">
<display-name>test</display-name>
</web-app>

View File

@ -147,12 +147,12 @@ public abstract class AbstractUnassembledWebAppMojo extends AbstractWebAppMojo
//On every subsequent re-run set it back to the original base dir before //On every subsequent re-run set it back to the original base dir before
//we might have applied any war overlays onto it //we might have applied any war overlays onto it
webApp.setBaseResource(originalBaseResource); webApp.setBaseResource(originalBaseResource);
if (webApp.getWar() == null)
webApp.setWar(originalBaseResource.getURI().toURL().toExternalForm());
//TODO the war does not need to be set, _except_ that QuickStartConfiguration checks for non null
if (webApp.getWar() == null)
webApp.setWar(originalBaseResource.toString());
if (classesDirectory != null) if (classesDirectory != null)
webApp.setClasses(classesDirectory); webApp.setClasses(classesDirectory);

View File

@ -0,0 +1,2 @@
invoker.goals = verify -V -e
#test-compile failsafe:integration-test

View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>org.eclipse.jetty.ee9.its</groupId>
<artifactId>it-parent-pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jetty.ee9.its.jetty-combinedresource-it</groupId>
<artifactId>jetty-simple-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>EE9 :: Webapp with multiple base resources</name>
<properties>
<jetty.port.file>${project.build.directory}/jetty-combinedresource-port.txt</jetty.port.file>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-maven-plugin</artifactId>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<jetty.port.file>${jetty.port.file}</jetty.port.file>
<maven.it.name>${project.groupId}:${project.artifactId}</maven.it.name>
<contentCheck>BLAH</contentCheck>
<pathToCheck>/blah.html</pathToCheck>
</systemPropertyVariables>
<dependenciesToScan>
<dependency>org.eclipse.jetty.ee9:jetty-ee9-maven-plugin</dependency>
</dependenciesToScan>
<includes>
<include>**/*TestGetContent*</include>
</includes>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-maven-plugin</artifactId>
<executions>
<execution>
<id>start-jetty</id>
<phase>test-compile</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<supportedPackagings>
<supportedPackaging>pom</supportedPackaging>
</supportedPackagings>
<webApp>
<resourceBases>
<resourceBase>${project.basedir}/public</resourceBase>
<resourceBase>${project.basedir}/src/main/webapp</resourceBase>
</resourceBases>
</webApp>
<systemProperties>
<jetty.port.file>${jetty.port.file}</jetty.port.file>
</systemProperties>
<jettyXmls>
<jettyXml>${basedir}/src/config/jetty.xml</jettyXml>
</jettyXmls>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
File buildLog = new File( basedir, 'build.log' )
assert buildLog.text.contains( 'Started Server' )
assert buildLog.text.contains( 'Running org.eclipse.jetty.ee9.maven.plugin.it.IntegrationTestGetContent')
assert buildLog.text.contains( 'contentCheck')

View File

@ -0,0 +1,40 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<Set name="secureScheme">https</Set>
<Set name="securePort"><Property name="jetty.secure.port" default="8443" /></Set>
<Set name="outputBufferSize">32768</Set>
<Set name="requestHeaderSize">8192</Set>
<Set name="responseHeaderSize">8192</Set>
<Set name="headerCacheSize">1024</Set>
</New>
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server" /></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref refid="httpConfig" /></Arg>
</New>
</Item>
</Array>
</Arg>
<Call name="addEventListener">
<Arg>
<New class="org.eclipse.jetty.ee9.maven.plugin.ServerConnectorListener">
<Set name="fileName"><Property name="jetty.port.file" default="port.txt"/></Set>
</New>
</Arg>
</Call>
<Set name="host" property="jetty.host"/>
<Set name="port" property="jetty.port"/>
<Set name="idleTimeout">30000</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_1.xsd"
metadata-complete="true"
version="3.1">
<display-name>test</display-name>
</web-app>

View File

@ -142,8 +142,9 @@ public abstract class AbstractUnassembledWebAppMojo extends AbstractWebAppMojo
//we might have applied any war overlays onto it //we might have applied any war overlays onto it
webApp.setBaseResource(originalBaseResource); webApp.setBaseResource(originalBaseResource);
//TODO the war does not need to be set, _except_ that QuickStartConfiguration checks for non null
if (webApp.getWar() == null) if (webApp.getWar() == null)
webApp.setWar(originalBaseResource.getURI().toURL().toExternalForm()); webApp.setWar(originalBaseResource.toString());
if (classesDirectory != null) if (classesDirectory != null)
webApp.setClasses(classesDirectory); webApp.setClasses(classesDirectory);