-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Issue #7677 Exclude findbugs jsr305 jar from plugin #7682
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
jetty-maven-plugin/src/it/exclude-javax-annotation/invoker.properties
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 @@ | ||
invoker.goals = test -e |
104 changes: 104 additions & 0 deletions
104
jetty-maven-plugin/src/it/exclude-javax-annotation/pom.xml
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,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> |
24 changes: 24 additions & 0 deletions
24
jetty-maven-plugin/src/it/exclude-javax-annotation/postbuild.groovy
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,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') | ||
|
40 changes: 40 additions & 0 deletions
40
jetty-maven-plugin/src/it/exclude-javax-annotation/src/config/jetty.xml
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,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> |
81 changes: 81 additions & 0 deletions
81
...aven-plugin/src/it/exclude-javax-annotation/src/main/java/org/github/unb/TestServlet.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,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; | ||
} | ||
|
||
} |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove System.out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this class has few more.
And you will see them only when using m-invoker-p in debug mode or streamLogs which is not the case per default but only when debugging or when an IT test fail.