mirror of
https://github.com/jetty/jetty.project.git
synced 2025-03-04 21:09:13 +00:00
* Issue #7677 Exclude findbugs jsr305 jar from plugin Signed-off-by: Jan Bartel <janb@webtide.com> * add IT test for those classes exclusions Signed-off-by: Olivier Lamy <oliver.lamy@gmail.com>
This commit is contained in:
parent
de5ddcd2b8
commit
761bb3f661
@ -0,0 +1 @@
|
|||||||
|
invoker.goals = test -e
|
104
jetty-maven-plugin/src/it/exclude-javax-annotation/pom.xml
Normal file
104
jetty-maven-plugin/src/it/exclude-javax-annotation/pom.xml
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
<?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.its</groupId>
|
||||||
|
<artifactId>it-parent-pom</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<groupId>org.github.unb</groupId>
|
||||||
|
<artifactId>jetty-7677</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
|
||||||
|
<name>jetty-7677</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<jetty.port.file>${project.build.directory}/jetty-start-it.txt</jetty.port.file>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
|
<classifier>tests</classifier>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<includes>
|
||||||
|
<include>IntegrationTest*.java</include>
|
||||||
|
</includes>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<jetty.port.file>${jetty.port.file}</jetty.port.file>
|
||||||
|
<context.path>/</context.path>
|
||||||
|
<pingServlet>fals</pingServlet>
|
||||||
|
<helloServlet>false</helloServlet>
|
||||||
|
<contentCheck>class javax.annotation.Nullable not found</contentCheck>
|
||||||
|
<pathToCheck>/test</pathToCheck>
|
||||||
|
<maven.it.name>${project.groupId}:${project.artifactId}</maven.it.name>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
<dependenciesToScan>
|
||||||
|
<dependency>org.eclipse.jetty:jetty-maven-plugin</dependency>
|
||||||
|
</dependenciesToScan>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-jetty</id>
|
||||||
|
<phase>test-compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>start</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<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>
|
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* 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.maven.plugin.it.IntegrationTestGetContent')
|
||||||
|
assert buildLog.text.contains( 'Tests run: 1, Failures: 0, Errors: 0, Skipped: 0')
|
||||||
|
assert buildLog.text.contains( 'contentCheck')
|
||||||
|
|
@ -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.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>
|
@ -0,0 +1,81 @@
|
|||||||
|
//
|
||||||
|
// ========================================================================
|
||||||
|
// Copyright (c) 1995-2022 Mort Bay Consulting Pty Ltd and others.
|
||||||
|
//
|
||||||
|
// This program and the accompanying materials are made available under the
|
||||||
|
// terms of the Eclipse Public License v. 2.0 which is available at
|
||||||
|
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
|
||||||
|
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||||
|
// ========================================================================
|
||||||
|
//
|
||||||
|
|
||||||
|
package org.github.unb;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@WebServlet("/test")
|
||||||
|
public class TestServlet extends HttpServlet {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
response.setContentType("text/plain");
|
||||||
|
|
||||||
|
try {
|
||||||
|
HttpServlet.class.getClassLoader().loadClass("javax.annotation.Nullable");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
response.getWriter().write("class javax.annotation.Nullable not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Enumeration<URL> resources = getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");
|
||||||
|
List<String> jars = new ArrayList<>();
|
||||||
|
while (resources.hasMoreElements()) {
|
||||||
|
URL url = resources.nextElement();
|
||||||
|
String jar = getJar(url);
|
||||||
|
if (jar != null) {
|
||||||
|
jars.add(jar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Collections.sort(jars);
|
||||||
|
String body = jars.stream().map(Object::toString).collect(Collectors.joining("\n", "", "\n"));
|
||||||
|
response.getWriter().write(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to determine the JAR from a MANIFEST.MF url.
|
||||||
|
*
|
||||||
|
* @param url the MANIFEST.MF url
|
||||||
|
* @return the corresponding jar, or {@code null} if one cannot be determined
|
||||||
|
*/
|
||||||
|
private String getJar(URL url) {
|
||||||
|
String result = null;
|
||||||
|
String path = url.getPath();
|
||||||
|
int index = path.lastIndexOf('!');
|
||||||
|
if (index > 0) {
|
||||||
|
path = path.substring(0, index);
|
||||||
|
index = path.lastIndexOf('/');
|
||||||
|
if (index >= 0) {
|
||||||
|
path = path.substring(index + 1);
|
||||||
|
result = path.length() > 0 ? path : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -61,6 +61,7 @@ public class IntegrationTestGetContent
|
|||||||
}
|
}
|
||||||
String contentCheck = System.getProperty("contentCheck");
|
String contentCheck = System.getProperty("contentCheck");
|
||||||
String pathToCheck = System.getProperty("pathToCheck");
|
String pathToCheck = System.getProperty("pathToCheck");
|
||||||
|
System.out.println("contentCheck: " + contentCheck);
|
||||||
if (StringUtils.isNotBlank(contentCheck))
|
if (StringUtils.isNotBlank(contentCheck))
|
||||||
{
|
{
|
||||||
String url = "http://localhost:" + port + contextPath;
|
String url = "http://localhost:" + port + contextPath;
|
||||||
|
5
pom.xml
5
pom.xml
@ -632,6 +632,7 @@
|
|||||||
<localRepositoryPath>${localRepoPath}</localRepositoryPath>
|
<localRepositoryPath>${localRepoPath}</localRepositoryPath>
|
||||||
<settingsFile>${settingsPath}</settingsFile>
|
<settingsFile>${settingsPath}</settingsFile>
|
||||||
<skipInvocation>${skipTests}</skipInvocation>
|
<skipInvocation>${skipTests}</skipInvocation>
|
||||||
|
<streamLogsOnFailures>true</streamLogsOnFailures>
|
||||||
<pomIncludes>
|
<pomIncludes>
|
||||||
<pomInclude>*/pom.xml</pomInclude>
|
<pomInclude>*/pom.xml</pomInclude>
|
||||||
</pomIncludes>
|
</pomIncludes>
|
||||||
@ -1179,6 +1180,10 @@
|
|||||||
<groupId>javax.inject</groupId>
|
<groupId>javax.inject</groupId>
|
||||||
<artifactId>javax.inject</artifactId>
|
<artifactId>javax.inject</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
<artifactId>jsr305</artifactId>
|
||||||
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user