diff --git a/Jenkinsfile b/Jenkinsfile index cc9bec25fd4..538bb9b8ac1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { agent { node { label 'linux' } } options { timeout(time: 120, unit: 'MINUTES') } steps { - mavenBuild("jdk8", "-Pmongodb install") + mavenBuild("jdk8", "-Pmongodb install", "maven3") // Collect up the jacoco execution results (only on main build) jacoco inclusionPattern: '**/org/eclipse/jetty/**/*.class', exclusionPattern: '' + @@ -34,11 +34,7 @@ pipeline { classPattern: '**/target/classes', sourcePattern: '**/src/main/java' warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'Java']] - - script { - step([$class : 'MavenInvokerRecorder', reportsFilenamePattern: "**/target/invoker-reports/BUILD*.xml", - invokerBuildDir: "**/target/its"]) - } + maven_invoker reportsFilenamePattern: "**/target/invoker-reports/BUILD*.xml", invokerBuildDir: "**/target/its" } } @@ -46,9 +42,10 @@ pipeline { agent { node { label 'linux' } } options { timeout(time: 120, unit: 'MINUTES') } steps { - mavenBuild("jdk11", "-Pmongodb install") + mavenBuild("jdk11", "-Pmongodb install", "maven3") junit '**/target/surefire-reports/TEST-*.xml,**/target/failsafe-reports/TEST-*.xml' warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'Java']] + maven_invoker reportsFilenamePattern: "**/target/invoker-reports/BUILD*.xml", invokerBuildDir: "**/target/its" } } @@ -56,7 +53,7 @@ pipeline { agent { node { label 'linux' } } options { timeout(time: 30, unit: 'MINUTES') } steps { - mavenBuild("jdk8", "install javadoc:javadoc -DskipTests") + mavenBuild("jdk8", "install javadoc:javadoc -DskipTests", "maven3") warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'JavaDoc'], [parserName: 'Java']] } } @@ -65,7 +62,7 @@ pipeline { agent { node { label 'linux' } } options { timeout(time: 120, unit: 'MINUTES') } steps { - mavenBuild("jdk8", "-Pcompact3 install -DskipTests") + mavenBuild("jdk8", "-Pcompact3 install -DskipTests", "maven3") warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'Java']] } } @@ -83,8 +80,7 @@ pipeline { * @param cmdline the command line in " "`format. * @return the Jenkinsfile step representing a maven build */ -def mavenBuild(jdk, cmdline) { - def mvnName = 'maven3.5' +def mavenBuild(jdk, cmdline, mvnName) { def localRepo = "${env.JENKINS_HOME}/${env.EXECUTOR_NUMBER}" // ".repository" // def settingsName = 'oss-settings.xml' def mavenOpts = '-Xms1g -Xmx4g -Djava.awt.headless=true' diff --git a/jetty-maven-plugin/src/it/javax-annotation-api/invoker.properties b/jetty-maven-plugin/src/it/javax-annotation-api/invoker.properties new file mode 100644 index 00000000000..e0222d4d54e --- /dev/null +++ b/jetty-maven-plugin/src/it/javax-annotation-api/invoker.properties @@ -0,0 +1 @@ +invoker.goals = test \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/javax-annotation-api/pom.xml b/jetty-maven-plugin/src/it/javax-annotation-api/pom.xml new file mode 100644 index 00000000000..4ef25cb17c3 --- /dev/null +++ b/jetty-maven-plugin/src/it/javax-annotation-api/pom.xml @@ -0,0 +1,103 @@ + + + + 4.0.0 + + + + + org.eclipse.jetty.its + it-parent-pom + 0.0.1-SNAPSHOT + + + javax-annotation-api-test + 1.0.0-SNAPSHOT + war + + + + UTF-8 + 8 + 8 + + ${project.build.directory}/jetty-run-mojo-annotation.txt + 1.3.2 + + + + + javax.servlet + javax.servlet-api + 4.0.1 + provided + + + javax.annotation + javax.annotation-api + ${annotation-api.version} + + + org.springframework.boot + spring-boot-autoconfigure + 2.1.1.RELEASE + + + org.springframework.boot + spring-boot-starter-web + 2.1.1.RELEASE + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + + + + + + org.eclipse.jetty + jetty-maven-plugin + + + start-jetty + test-compile + + start + + + + + jetty.port.file + ${jetty.port.file} + + + true + + + + + + + + + javax.annotation + javax.annotation-api + ${annotation-api.version} + + + javax.annotation + jsr250-api + 1.0 + + + + diff --git a/jetty-maven-plugin/src/it/javax-annotation-api/postbuild.groovy b/jetty-maven-plugin/src/it/javax-annotation-api/postbuild.groovy new file mode 100644 index 00000000000..9533c9ecc2c --- /dev/null +++ b/jetty-maven-plugin/src/it/javax-annotation-api/postbuild.groovy @@ -0,0 +1,21 @@ +/* + * 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 Jetty Server' ) +assert buildLog.text.contains( 'all good guys get a good Beer') diff --git a/jetty-maven-plugin/src/it/javax-annotation-api/src/main/java/test/App.java b/jetty-maven-plugin/src/it/javax-annotation-api/src/main/java/test/App.java new file mode 100644 index 00000000000..d03ad70999b --- /dev/null +++ b/jetty-maven-plugin/src/it/javax-annotation-api/src/main/java/test/App.java @@ -0,0 +1,64 @@ +// +// ======================================================================== +// Copyright (c) 1995-2018 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package test; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.context.annotation.Bean; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.io.InputStream; +import java.util.Properties; + +/** + * Hello world! + * + */ +public class App extends SpringBootServletInitializer { + + private Logger logger = LoggerFactory.getLogger( getClass() ); + + @Resource(name="my.properties") + private Properties somePropertyFile; + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder ) { + return builder.sources( App.class ); + } + + @PostConstruct + public void done(){ + logger.info( "all good guys get a good {}", somePropertyFile.get( "drink" ) ); + + } + + @Bean(name = "my.properties") + public Properties getSomeProperties() throws Exception{ + Properties properties = new Properties( ); + try(InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream( "my.properties" )) + { + properties.load( inputStream ); + } + return properties; + } + +} diff --git a/jetty-maven-plugin/src/it/javax-annotation-api/src/main/resources/my.properties b/jetty-maven-plugin/src/it/javax-annotation-api/src/main/resources/my.properties new file mode 100644 index 00000000000..5c07b0ed01e --- /dev/null +++ b/jetty-maven-plugin/src/it/javax-annotation-api/src/main/resources/my.properties @@ -0,0 +1 @@ +drink=Beer