Port the build to Gradle
Closes gh-19609 Closes gh-19608
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
plugins {
|
||||
id 'org.asciidoctor.jvm.convert'
|
||||
id 'org.asciidoctor.jvm.pdf'
|
||||
id 'org.springframework.boot.conventions'
|
||||
id 'org.springframework.boot.maven-plugin'
|
||||
id 'org.springframework.boot.optional-dependencies'
|
||||
}
|
||||
|
||||
description = "Spring Boot Maven Plugin"
|
||||
|
||||
configurations {
|
||||
documentation
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'org.apache.maven.plugin-tools:maven-plugin-annotations'
|
||||
compileOnly 'org.sonatype.plexus:plexus-build-api'
|
||||
|
||||
implementation enforcedPlatform(project(':spring-boot-project:spring-boot-parent'))
|
||||
implementation project(':spring-boot-project:spring-boot-tools:spring-boot-loader-tools')
|
||||
implementation 'org.apache.maven.shared:maven-common-artifact-filters'
|
||||
implementation 'org.apache.maven:maven-plugin-api'
|
||||
|
||||
intTestImplementation enforcedPlatform(project(':spring-boot-project:spring-boot-parent'))
|
||||
intTestImplementation 'org.apache.maven.shared:maven-invoker'
|
||||
intTestImplementation 'org.assertj:assertj-core'
|
||||
intTestImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
|
||||
optional enforcedPlatform(project(':spring-boot-project:spring-boot-parent'))
|
||||
optional 'org.apache.maven.plugins:maven-shade-plugin'
|
||||
|
||||
runtimeOnly 'org.sonatype.plexus:plexus-build-api'
|
||||
|
||||
testImplementation enforcedPlatform(project(':spring-boot-project:spring-boot-parent'))
|
||||
testImplementation 'org.assertj:assertj-core'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
testImplementation 'org.mockito:mockito-core'
|
||||
testImplementation 'org.springframework:spring-core'
|
||||
}
|
||||
|
||||
syncDocumentationSourceForAsciidoctor {
|
||||
from(documentPluginGoals) {
|
||||
into 'asciidoc/goals'
|
||||
}
|
||||
}
|
||||
|
||||
asciidoctor {
|
||||
sources {
|
||||
include 'index.adoc'
|
||||
}
|
||||
}
|
||||
|
||||
syncDocumentationSourceForAsciidoctorPdf {
|
||||
from(documentPluginGoals) {
|
||||
into 'asciidoc/goals'
|
||||
}
|
||||
}
|
||||
|
||||
asciidoctorPdf {
|
||||
sources {
|
||||
include 'index.adoc'
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) {
|
||||
attributes 'maven-jar-plugin-version': '1.2.3',
|
||||
'maven-failsafe-plugin-version': '1.2.3',
|
||||
'build-helper-maven-plugin-version': '1.2.3'
|
||||
}
|
||||
|
||||
task zip(type: Zip) {
|
||||
dependsOn asciidoctor, asciidoctorPdf
|
||||
duplicatesStrategy 'fail'
|
||||
from(asciidoctorPdf.outputDir) {
|
||||
into 'pdf'
|
||||
}
|
||||
from(asciidoctor.outputDir) {
|
||||
into 'html'
|
||||
}
|
||||
}
|
||||
|
||||
prepareMavenBinaries {
|
||||
versions '3.6.2', '3.5.4'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
'documentation' zip
|
||||
}
|
||||
@@ -1,499 +0,0 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-tools</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<name>Spring Boot Maven Plugin</name>
|
||||
<description>Spring Boot Maven Plugin</description>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../../..</main.basedir>
|
||||
<maven.version>3.3.9</maven.version>
|
||||
<refdocs.build.directory>${project.build.directory}/refdocs/</refdocs.build.directory>
|
||||
</properties>
|
||||
<scm>
|
||||
<url>${git.url}</url>
|
||||
<connection>${git.connection}</connection>
|
||||
<developerConnection>${git.developerConnection}</developerConnection>
|
||||
</scm>
|
||||
<dependencies>
|
||||
<!-- Compile -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-loader-tools</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-archiver</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.enterprise</groupId>
|
||||
<artifactId>cdi-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-settings</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-common-artifact-filters</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.enterprise</groupId>
|
||||
<artifactId>cdi-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-component-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.sonatype.plexus</groupId>
|
||||
<artifactId>plexus-build-api</artifactId>
|
||||
</dependency>
|
||||
<!-- Optional -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- Provided -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||
<artifactId>maven-plugin-annotations</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<configuration>
|
||||
<goalPrefix>spring-boot</goalPrefix>
|
||||
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-descriptor</id>
|
||||
<goals>
|
||||
<goal>descriptor</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>generated-helpmojo</id>
|
||||
<goals>
|
||||
<goal>helpmojo</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>integration</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-invoker-plugin</artifactId>
|
||||
<configuration>
|
||||
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>prepare-integration-test</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>install</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>integration-test</id>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
|
||||
<settingsFile>src/it/settings.xml</settingsFile>
|
||||
<postBuildHookScript>verify</postBuildHookScript>
|
||||
<addTestClassPath>true</addTestClassPath>
|
||||
<skipInvocation>${skipTests}</skipInvocation>
|
||||
<streamLogs>true</streamLogs>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>cleanup-local-integration-repo</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<replaceregexp match="\$\{revision\}" replace="${project.version}"
|
||||
flags="g" byline="true">
|
||||
<fileset
|
||||
dir="${project.build.directory}/local-repo/org/springframework/boot/"
|
||||
includes="**/*.pom" />
|
||||
</replaceregexp>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>full</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>full</name>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-invoker-plugin</artifactId>
|
||||
<configuration>
|
||||
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>prepare-integration-test</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>install</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>integration-test</id>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
|
||||
<settingsFile>src/it/settings.xml</settingsFile>
|
||||
<postBuildHookScript>verify</postBuildHookScript>
|
||||
<addTestClassPath>true</addTestClassPath>
|
||||
<skipInvocation>${skipTests}</skipInvocation>
|
||||
<streamLogs>true</streamLogs>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ant-contrib</groupId>
|
||||
<artifactId>ant-contrib</artifactId>
|
||||
<version>1.0b3</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-nodeps</artifactId>
|
||||
<version>1.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.tigris.antelope</groupId>
|
||||
<artifactId>antelopetasks</artifactId>
|
||||
<version>3.2.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>cleanup-local-integration-repo</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<replaceregexp match="\$\{revision\}" replace="${project.version}"
|
||||
flags="g" byline="true">
|
||||
<fileset
|
||||
dir="${project.build.directory}/local-repo/org/springframework/boot/"
|
||||
includes="**/*.pom" />
|
||||
</replaceregexp>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>set-up-maven-properties</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<exportAntProperties>true</exportAntProperties>
|
||||
<target>
|
||||
<taskdef
|
||||
resource="net/sf/antcontrib/antcontrib.properties" />
|
||||
<taskdef name="stringutil"
|
||||
classname="ise.antelope.tasks.StringUtilTask" />
|
||||
<var name="version-type" value="${project.version}" />
|
||||
<propertyregex property="version-type"
|
||||
override="true" input="${version-type}" regexp=".*\.(.*)"
|
||||
replace="\1" />
|
||||
<propertyregex property="version-type"
|
||||
override="true" input="${version-type}" regexp="(M)\d+"
|
||||
replace="MILESTONE" />
|
||||
<propertyregex property="version-type"
|
||||
override="true" input="${version-type}" regexp="(RC)\d+"
|
||||
replace="MILESTONE" />
|
||||
<propertyregex property="version-type"
|
||||
override="true" input="${version-type}" regexp="BUILD-(.*)"
|
||||
replace="SNAPSHOT" />
|
||||
<var name="github-tag" value="v${project.version}" />
|
||||
<propertyregex property="github-tag"
|
||||
override="true" input="${github-tag}" regexp=".*SNAPSHOT"
|
||||
replace="master" />
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>package-docs-zip</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<zip
|
||||
destfile="${project.build.directory}/${project.artifactId}-${project.version}-docs.zip">
|
||||
<zipfileset
|
||||
dir="${project.build.directory}/generated-docs/reference/html"
|
||||
prefix="html" />
|
||||
<mappedresources>
|
||||
<fileset
|
||||
dir="${project.build.directory}/generated-docs/reference/pdf"
|
||||
includes="index.pdf" />
|
||||
<globmapper from="index.pdf"
|
||||
to="pdf/spring-boot-maven-plugin.pdf" />
|
||||
</mappedresources>
|
||||
</zip>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.googlecode.maven-download-plugin</groupId>
|
||||
<artifactId>download-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack-doc-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>wget</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<url>${spring-doc-resources.url}</url>
|
||||
<unpack>true</unpack>
|
||||
<outputDirectory>${refdocs.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.gmavenplus</groupId>
|
||||
<artifactId>gmavenplus-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>execute</goal>
|
||||
</goals>
|
||||
<phase>prepare-package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<scripts>
|
||||
<script>file:///${project.basedir}/src/main/groovy/generateGoalsDocumentation.groovy</script>
|
||||
</scripts>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-ant</artifactId>
|
||||
<version>${groovy.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-xml</artifactId>
|
||||
<version>${groovy.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-html-documentation</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>process-asciidoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<backend>html5</backend>
|
||||
<outputDirectory>${project.build.directory}/generated-docs/reference/html</outputDirectory>
|
||||
<sourceHighlighter>highlight.js</sourceHighlighter>
|
||||
<doctype>book</doctype>
|
||||
<attributes>
|
||||
<highlightjsdir>js/highlight</highlightjsdir>
|
||||
<highlightjs-theme>github</highlightjs-theme>
|
||||
<linkcss>true</linkcss>
|
||||
<imagesdir>./images</imagesdir>
|
||||
<icons>font</icons>
|
||||
<stylesdir>css/</stylesdir>
|
||||
<stylesheet>spring.css</stylesheet>
|
||||
<attribute-missing>warn</attribute-missing>
|
||||
</attributes>
|
||||
<logHandler>
|
||||
<outputToConsole>true</outputToConsole>
|
||||
<failIf>
|
||||
<severity>DEBUG</severity>
|
||||
</failIf>
|
||||
</logHandler>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>generate-pdf-documentation</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>process-asciidoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<backend>pdf</backend>
|
||||
<outputDirectory>${project.build.directory}/generated-docs/reference/pdf</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<sourceDirectory>${refdocs.build.directory}</sourceDirectory>
|
||||
<sourceDocumentName>index.adoc</sourceDocumentName>
|
||||
<attributes>
|
||||
<version>${project.version}</version>
|
||||
<build-helper-maven-plugin-version>${build-helper-maven-plugin.version}</build-helper-maven-plugin-version>
|
||||
<maven-failsafe-plugin-version>${maven-failsafe-plugin.version}</maven-failsafe-plugin-version>
|
||||
<maven-jar-plugin-version>${maven-jar-plugin.version}</maven-jar-plugin-version>
|
||||
<generated-resources-root>${project.basedir}/target/generated-resources</generated-resources-root>
|
||||
</attributes>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctorj-pdf</artifactId>
|
||||
<version>1.5.0-alpha.18</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-asciidoc-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${refdocs.build.directory}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/asciidoc</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-zip</id>
|
||||
<goals>
|
||||
<goal>attach-artifact</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifacts>
|
||||
<artifact>
|
||||
<file>${project.build.directory}/${project.artifactId}-${project.version}-docs.zip</file>
|
||||
<type>zip</type>
|
||||
<classifier>docs</classifier>
|
||||
</artifact>
|
||||
</artifacts>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
@@ -38,4 +38,4 @@ This configuration will generate a `build-info.properties` at the expected locat
|
||||
Note that `maven.compiler.source` and `maven.compiler.target` are expected to be regular properties available in the project.
|
||||
They will be interpolated as you would expect.
|
||||
|
||||
include::{generated-resources-root}/goals/build-info.adoc[leveloffset=+1]
|
||||
include::goals/build-info.adoc[leveloffset=+1]
|
||||
@@ -3,5 +3,5 @@
|
||||
|
||||
The Spring Boot Plugin has the following goals:
|
||||
|
||||
include::{generated-resources-root}/goals/overview.adoc[]
|
||||
include::goals/overview.adoc[]
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
== Help information
|
||||
The `help` goal is a standard goal that displays information on the capabilities of the plugin.
|
||||
|
||||
include::{generated-resources-root}/goals/help.adoc[leveloffset=+1]
|
||||
include::goals/help.adoc[leveloffset=+1]
|
||||
@@ -35,9 +35,9 @@ Such setup can now use the https://maven.apache.org/surefire/maven-failsafe-plug
|
||||
|
||||
You could also configure a more advanced setup to skip the integration tests when a specific property has been set, see <<integration-tests-example-skip,the dedicated example>>.
|
||||
|
||||
include::{generated-resources-root}/goals/start.adoc[leveloffset=+1]
|
||||
include::goals/start.adoc[leveloffset=+1]
|
||||
|
||||
include::{generated-resources-root}/goals/stop.adoc[leveloffset=+1]
|
||||
include::goals/stop.adoc[leveloffset=+1]
|
||||
|
||||
|
||||
[[integration-tests-example]]
|
||||
@@ -71,7 +71,7 @@ The `layout` property defaults to a guess based on the archive type (`jar` or `w
|
||||
* `ZIP` (alias to `DIR`): similar to the `JAR` layout using `PropertiesLauncher`.
|
||||
* `NONE`: Bundle all dependencies and project resources. Does not bundle a bootstrap loader.
|
||||
|
||||
include::{generated-resources-root}/goals/repackage.adoc[leveloffset=+1]
|
||||
include::goals/repackage.adoc[leveloffset=+1]
|
||||
|
||||
[[repackage-examples]]
|
||||
=== Examples
|
||||
@@ -78,7 +78,7 @@ For example, if you want to run your application in a test mode that uses stub c
|
||||
If you wish to do this, you can set the `useTestClasspath` parameter to true.
|
||||
Note that this is only applied when you run an application: the `repackage` goal will not add test dependencies to the resulting JAR/WAR.
|
||||
|
||||
include::{generated-resources-root}/goals/run.adoc[leveloffset=+1]
|
||||
include::goals/run.adoc[leveloffset=+1]
|
||||
|
||||
[[run-examples]]
|
||||
=== Examples
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.boot.maven;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.assertj.core.api.AbstractAssert;
|
||||
import org.assertj.core.api.AssertProvider;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.contentOf;
|
||||
|
||||
/**
|
||||
* Base class for archive (jar or war) related Maven plugin integration tests.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
abstract class AbstractArchiveIntegrationTests {
|
||||
|
||||
protected String buildLog(File project) {
|
||||
return contentOf(new File(project, "target/build.log"));
|
||||
}
|
||||
|
||||
protected String launchScript(File jar) {
|
||||
String content = contentOf(jar);
|
||||
return content.substring(0, content.indexOf(new String(new byte[] { 0x50, 0x4b, 0x03, 0x04 })));
|
||||
}
|
||||
|
||||
protected AssertProvider<JarAssert> jar(File file) {
|
||||
return new AssertProvider<JarAssert>() {
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public JarAssert assertThat() {
|
||||
return new JarAssert(file);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
static final class JarAssert extends AbstractAssert<JarAssert, File> {
|
||||
|
||||
private JarAssert(File actual) {
|
||||
super(actual, JarAssert.class);
|
||||
assertThat(actual.exists());
|
||||
}
|
||||
|
||||
JarAssert doesNotHaveEntryWithName(String name) {
|
||||
withJarFile((jarFile) -> {
|
||||
withEntries(jarFile, (entries) -> {
|
||||
Optional<JarEntry> match = entries.filter((entry) -> entry.getName().equals(name)).findFirst();
|
||||
assertThat(match).isNotPresent();
|
||||
});
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
JarAssert hasEntryWithName(String name) {
|
||||
withJarFile((jarFile) -> {
|
||||
withEntries(jarFile, (entries) -> {
|
||||
Optional<JarEntry> match = entries.filter((entry) -> entry.getName().equals(name)).findFirst();
|
||||
assertThat(match).hasValueSatisfying((entry) -> assertThat(entry.getComment()).isNull());
|
||||
});
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
JarAssert hasEntryWithNameStartingWith(String prefix) {
|
||||
withJarFile((jarFile) -> {
|
||||
withEntries(jarFile, (entries) -> {
|
||||
Optional<JarEntry> match = entries.filter((entry) -> entry.getName().startsWith(prefix))
|
||||
.findFirst();
|
||||
assertThat(match).hasValueSatisfying((entry) -> assertThat(entry.getComment()).isNull());
|
||||
});
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
JarAssert hasUnpackEntryWithNameStartingWith(String prefix) {
|
||||
withJarFile((jarFile) -> {
|
||||
withEntries(jarFile, (entries) -> {
|
||||
Optional<JarEntry> match = entries.filter((entry) -> entry.getName().startsWith(prefix))
|
||||
.findFirst();
|
||||
assertThat(match).as("Name starting with %s", prefix)
|
||||
.hasValueSatisfying((entry) -> assertThat(entry.getComment()).startsWith("UNPACK:"));
|
||||
});
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
JarAssert doesNotHaveEntryWithNameStartingWith(String prefix) {
|
||||
withJarFile((jarFile) -> {
|
||||
withEntries(jarFile, (entries) -> {
|
||||
Optional<JarEntry> match = entries.filter((entry) -> entry.getName().startsWith(prefix))
|
||||
.findFirst();
|
||||
assertThat(match).isNotPresent();
|
||||
});
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
JarAssert manifest(Consumer<ManifestAssert> consumer) {
|
||||
withJarFile((jarFile) -> {
|
||||
try {
|
||||
consumer.accept(new ManifestAssert(jarFile.getManifest()));
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
void withJarFile(Consumer<JarFile> consumer) {
|
||||
try (JarFile jarFile = new JarFile(this.actual)) {
|
||||
consumer.accept(jarFile);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
void withEntries(JarFile jarFile, Consumer<Stream<JarEntry>> entries) {
|
||||
entries.accept(Collections.list(jarFile.entries()).stream());
|
||||
}
|
||||
|
||||
static final class ManifestAssert extends AbstractAssert<ManifestAssert, Manifest> {
|
||||
|
||||
private ManifestAssert(Manifest actual) {
|
||||
super(actual, ManifestAssert.class);
|
||||
}
|
||||
|
||||
ManifestAssert hasStartClass(String expected) {
|
||||
assertThat(this.actual.getMainAttributes().getValue("Start-Class")).isEqualTo(expected);
|
||||
return this;
|
||||
}
|
||||
|
||||
ManifestAssert hasMainClass(String expected) {
|
||||
assertThat(this.actual.getMainAttributes().getValue("Main-Class")).isEqualTo(expected);
|
||||
return this;
|
||||
}
|
||||
|
||||
ManifestAssert hasAttribute(String name, String value) {
|
||||
assertThat(this.actual.getMainAttributes().getValue(name)).isEqualTo(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.boot.maven;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.assertj.core.api.AbstractMapAssert;
|
||||
import org.assertj.core.api.AssertProvider;
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for the Maven plugin's build info support.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@ExtendWith(MavenBuildExtension.class)
|
||||
public class BuildInfoIntegrationTests {
|
||||
|
||||
@TestTemplate
|
||||
void buildInfoPropertiesAreGenerated(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("build-info").execute(buildInfo((buildInfo) -> assertThat(buildInfo)
|
||||
.hasBuildGroup("org.springframework.boot.maven.it").hasBuildArtifact("build-info")
|
||||
.hasBuildName("Generate build info").hasBuildVersion("0.0.1.BUILD-SNAPSHOT").containsBuildTime()));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void generatedBuildInfoIncludesAdditionalProperties(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("build-info-additional-properties").execute(buildInfo((buildInfo) -> assertThat(buildInfo)
|
||||
.hasBuildGroup("org.springframework.boot.maven.it").hasBuildArtifact("build-info-additional-properties")
|
||||
.hasBuildName("Generate build info with additional properties").hasBuildVersion("0.0.1.BUILD-SNAPSHOT")
|
||||
.containsBuildTime().containsEntry("build.foo", "bar").containsEntry("build.encoding", "UTF-8")
|
||||
.containsEntry("build.java.source", "1.8")));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void generatedBuildInfoUsesCustomBuildTime(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("build-info-custom-build-time").execute(buildInfo((buildInfo) -> assertThat(buildInfo)
|
||||
.hasBuildGroup("org.springframework.boot.maven.it").hasBuildArtifact("build-info-custom-build-time")
|
||||
.hasBuildName("Generate build info with custom build time").hasBuildVersion("0.0.1.BUILD-SNAPSHOT")
|
||||
.hasBuildTime("2019-07-08T08:00:00Z")));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void buildInfoPropertiesAreGeneratedToCustomOutputLocation(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("build-info-custom-file")
|
||||
.execute(buildInfo("target/build.info",
|
||||
(buildInfo) -> assertThat(buildInfo).hasBuildGroup("org.springframework.boot.maven.it")
|
||||
.hasBuildArtifact("build-info-custom-file").hasBuildName("Generate custom build info")
|
||||
.hasBuildVersion("0.0.1.BUILD-SNAPSHOT").containsBuildTime()));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenBuildTimeIsDisabledIfDoesNotAppearInGeneratedBuildInfo(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("build-info-disable-build-time").execute(buildInfo((buildInfo) -> assertThat(buildInfo)
|
||||
.hasBuildGroup("org.springframework.boot.maven.it").hasBuildArtifact("build-info-disable-build-time")
|
||||
.hasBuildName("Generate build info with disabled build time").hasBuildVersion("0.0.1.BUILD-SNAPSHOT")
|
||||
.doesNotContainBuildTime()));
|
||||
}
|
||||
|
||||
private Consumer<File> buildInfo(Consumer<AssertProvider<BuildInfoAssert>> buildInfo) {
|
||||
return buildInfo("target/classes/META-INF/build-info.properties", buildInfo);
|
||||
}
|
||||
|
||||
private Consumer<File> buildInfo(String location, Consumer<AssertProvider<BuildInfoAssert>> buildInfo) {
|
||||
return (project) -> buildInfo.accept((buildInfo(project, location)));
|
||||
}
|
||||
|
||||
private AssertProvider<BuildInfoAssert> buildInfo(File project, String buildInfo) {
|
||||
return new AssertProvider<BuildInfoAssert>() {
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public BuildInfoAssert assertThat() {
|
||||
return new BuildInfoAssert(new File(project, buildInfo));
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
private static final class BuildInfoAssert extends AbstractMapAssert<BuildInfoAssert, Properties, Object, Object> {
|
||||
|
||||
private BuildInfoAssert(File actual) {
|
||||
super(loadProperties(actual), BuildInfoAssert.class);
|
||||
}
|
||||
|
||||
private static Properties loadProperties(File file) {
|
||||
try (FileReader reader = new FileReader(file)) {
|
||||
Properties properties = new Properties();
|
||||
properties.load(reader);
|
||||
return properties;
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
BuildInfoAssert hasBuildGroup(String expected) {
|
||||
return containsEntry("build.group", expected);
|
||||
}
|
||||
|
||||
BuildInfoAssert hasBuildArtifact(String expected) {
|
||||
return containsEntry("build.artifact", expected);
|
||||
}
|
||||
|
||||
BuildInfoAssert hasBuildName(String expected) {
|
||||
return containsEntry("build.name", expected);
|
||||
}
|
||||
|
||||
BuildInfoAssert hasBuildVersion(String expected) {
|
||||
return containsEntry("build.version", expected);
|
||||
}
|
||||
|
||||
BuildInfoAssert containsBuildTime() {
|
||||
return containsKey("build.time");
|
||||
}
|
||||
|
||||
BuildInfoAssert doesNotContainBuildTime() {
|
||||
return doesNotContainKey("build.time");
|
||||
}
|
||||
|
||||
BuildInfoAssert hasBuildTime(String expected) {
|
||||
return containsEntry("build.time", expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.boot.maven;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for the Maven plugin's jar support.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@ExtendWith(MavenBuildExtension.class)
|
||||
class JarIntegrationTests extends AbstractArchiveIntegrationTests {
|
||||
|
||||
@TestTemplate
|
||||
void whenJarIsRepackagedInPlaceOnlyRepackagedJarIsInstalled(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar").goals("install").execute((project) -> {
|
||||
File original = new File(project, "target/jar-0.0.1.BUILD-SNAPSHOT.jar.original");
|
||||
assertThat(original).isFile();
|
||||
File repackaged = new File(project, "target/jar-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(launchScript(repackaged)).isEmpty();
|
||||
assertThat(jar(repackaged)).manifest((manifest) -> {
|
||||
manifest.hasMainClass("org.springframework.boot.loader.JarLauncher");
|
||||
manifest.hasStartClass("some.random.Main");
|
||||
manifest.hasAttribute("Not-Used", "Foo");
|
||||
}).hasEntryWithNameStartingWith("BOOT-INF/lib/spring-context")
|
||||
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-core")
|
||||
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-jcl")
|
||||
.hasEntryWithNameStartingWith("BOOT-INF/lib/jakarta.servlet-api-4")
|
||||
.hasEntryWithName("BOOT-INF/classes/org/test/SampleApplication.class")
|
||||
.hasEntryWithName("org/springframework/boot/loader/JarLauncher.class");
|
||||
assertThat(buildLog(project)).contains("Replacing main artifact with repackaged archive")
|
||||
.contains("Installing " + repackaged + " to").doesNotContain("Installing " + original + " to");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenAttachIsDisabledOnlyTheOriginalJarIsInstalled(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-attach-disabled").goals("install").execute((project) -> {
|
||||
File original = new File(project, "target/jar-attach-disabled-0.0.1.BUILD-SNAPSHOT.jar.original");
|
||||
assertThat(original).isFile();
|
||||
File main = new File(project, "target/jar-attach-disabled-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(main).isFile();
|
||||
assertThat(buildLog(project)).contains("Updating main artifact " + main + " to " + original)
|
||||
.contains("Installing " + original + " to").doesNotContain("Installing " + main + " to");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenAClassifierIsConfiguredTheRepackagedJarHasAClassifierAndBothItAndTheOriginalAreInstalled(
|
||||
MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-classifier-main").goals("install").execute((project) -> {
|
||||
assertThat(new File(project, "target/jar-classifier-main-0.0.1.BUILD-SNAPSHOT.jar.original"))
|
||||
.doesNotExist();
|
||||
File main = new File(project, "target/jar-classifier-main-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(main).isFile();
|
||||
File repackaged = new File(project, "target/jar-classifier-main-0.0.1.BUILD-SNAPSHOT-test.jar");
|
||||
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/");
|
||||
assertThat(buildLog(project))
|
||||
.contains("Attaching repackaged archive " + repackaged + " with classifier test")
|
||||
.doesNotContain("Creating repackaged archive " + repackaged + " with classifier test")
|
||||
.contains("Installing " + main + " to").contains("Installing " + repackaged + " to");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenBothJarsHaveTheSameClassifierRepackagingIsDoneInPlaceAndOnlyRepackagedJarIsInstalled(
|
||||
MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-classifier-source").goals("install").execute((project) -> {
|
||||
File original = new File(project, "target/jar-classifier-source-0.0.1.BUILD-SNAPSHOT-test.jar.original");
|
||||
assertThat(original).isFile();
|
||||
File repackaged = new File(project, "target/jar-classifier-source-0.0.1.BUILD-SNAPSHOT-test.jar");
|
||||
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/");
|
||||
assertThat(buildLog(project)).contains("Replacing artifact with classifier test with repackaged archive")
|
||||
.doesNotContain("Installing " + original + " to").contains("Installing " + repackaged + " to");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenBothJarsHaveTheSameClassifierAndAttachIsDisabledOnlyTheOriginalJarIsInstalled(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-classifier-source-attach-disabled").goals("install").execute((project) -> {
|
||||
File original = new File(project,
|
||||
"target/jar-classifier-source-attach-disabled-0.0.1.BUILD-SNAPSHOT-test.jar.original");
|
||||
assertThat(original).isFile();
|
||||
File repackaged = new File(project,
|
||||
"target/jar-classifier-source-attach-disabled-0.0.1.BUILD-SNAPSHOT-test.jar");
|
||||
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/");
|
||||
assertThat(buildLog(project))
|
||||
.doesNotContain("Attaching repackaged archive " + repackaged + " with classifier test")
|
||||
.contains("Updating artifact with classifier test " + repackaged + " to " + original)
|
||||
.contains("Installing " + original + " to").doesNotContain("Installing " + repackaged + " to");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenAClassifierAndAnOutputDirectoryAreConfiguredTheRepackagedJarHasAClassifierAndIsWrittenToTheOutputDirectory(
|
||||
MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-create-dir").goals("install").execute((project) -> {
|
||||
File repackaged = new File(project, "target/foo/jar-create-dir-0.0.1.BUILD-SNAPSHOT-foo.jar");
|
||||
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/");
|
||||
assertThat(buildLog(project)).contains("Installing " + repackaged + " to");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenAnOutputDirectoryIsConfiguredTheRepackagedJarIsWrittenToIt(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-custom-dir").goals("install").execute((project) -> {
|
||||
File repackaged = new File(project, "target/foo/jar-custom-dir-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/");
|
||||
assertThat(buildLog(project)).contains("Installing " + repackaged + " to");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenACustomLaunchScriptIsConfiguredItAppearsInTheRepackagedJar(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-custom-launcher").goals("install").execute((project) -> {
|
||||
File repackaged = new File(project, "target/jar-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/");
|
||||
assertThat(launchScript(repackaged)).contains("Hello world");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenAnEntryIsExcludedItDoesNotAppearInTheRepackagedJar(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-exclude-entry").goals("install").execute((project) -> {
|
||||
File repackaged = new File(project, "target/jar-exclude-entry-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/")
|
||||
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-context")
|
||||
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-core")
|
||||
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-jcl")
|
||||
.doesNotHaveEntryWithName("BOOT-INF/lib/servlet-api-2.5.jar");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenAGroupIsExcludedNoEntriesInThatGroupAppearInTheRepackagedJar(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-exclude-group").goals("install").execute((project) -> {
|
||||
File repackaged = new File(project, "target/jar-exclude-group-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/")
|
||||
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-context")
|
||||
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-core")
|
||||
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-jcl")
|
||||
.doesNotHaveEntryWithName("BOOT-INF/lib/log4j-api-2.4.1.jar");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenAJarIsExecutableItBeginsWithTheDefaultLaunchScript(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-executable").execute((project) -> {
|
||||
File repackaged = new File(project, "target/jar-executable-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/");
|
||||
assertThat(launchScript(repackaged)).contains("Spring Boot Startup Script")
|
||||
.contains("MyFullyExecutableJarName").contains("MyFullyExecutableJarDesc");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenAJarIsBuiltWithLibrariesWithConflictingNamesTheyAreMadeUniqueUsingTheirGroupIds(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-lib-name-conflict").execute((project) -> {
|
||||
File repackaged = new File(project, "test-project/target/test-project-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/")
|
||||
.hasEntryWithName(
|
||||
"BOOT-INF/lib/org.springframework.boot.maven.it-acme-lib-0.0.1.BUILD-SNAPSHOT.jar")
|
||||
.hasEntryWithName(
|
||||
"BOOT-INF/lib/org.springframework.boot.maven.it.another-acme-lib-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenAProjectUsesPomPackagingRepackagingIsSkipped(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-pom").execute((project) -> {
|
||||
File target = new File(project, "target");
|
||||
assertThat(target.listFiles()).containsExactly(new File(target, "build.log"));
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenRepackagingIsSkippedTheJarIsNotRepackaged(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-skip").execute((project) -> {
|
||||
File main = new File(project, "target/jar-skip-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(main)).doesNotHaveEntryWithNameStartingWith("org/springframework/boot");
|
||||
assertThat(new File(project, "target/jar-skip-0.0.1.BUILD-SNAPSHOT.jar.original")).doesNotExist();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenADependencyHasSystemScopeAndInclusionOfSystemScopeDependenciesIsEnabledItIsIncludedInTheRepackagedJar(
|
||||
MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-system-scope").execute((project) -> {
|
||||
File main = new File(project, "target/jar-system-scope-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(main)).hasEntryWithName("BOOT-INF/lib/sample-1.0.0.jar");
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenADependencyHasSystemScopeItIsNotIncludedInTheRepackagedJar(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-system-scope-default").execute((project) -> {
|
||||
File main = new File(project, "target/jar-system-scope-default-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(main)).doesNotHaveEntryWithName("BOOT-INF/lib/sample-1.0.0.jar");
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenADependendencyHasTestScopeItIsNotIncludedInTheRepackagedJar(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-test-scope").execute((project) -> {
|
||||
File main = new File(project, "target/jar-test-scope-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(main)).doesNotHaveEntryWithNameStartingWith("BOOT-INF/lib/log4j")
|
||||
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenAProjectUsesKotlinItsModuleMetadataIsRepackagedIntoBootInfClasses(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-with-kotlin-module").execute((project) -> {
|
||||
File main = new File(project, "target/jar-with-kotlin-module-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(main)).hasEntryWithName("BOOT-INF/classes/META-INF/jar-with-kotlin-module.kotlin_module");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenAProjectIsBuiltWithALayoutPropertyTheSpecifiedLayoutIsUsed(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-with-layout-property").goals("package", "-Dspring-boot.repackage.layout=ZIP")
|
||||
.execute((project) -> {
|
||||
File main = new File(project, "target/jar-with-layout-property-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(main)).manifest(
|
||||
(manifest) -> manifest.hasMainClass("org.springframework.boot.loader.PropertiesLauncher")
|
||||
.hasStartClass("org.test.SampleApplication"));
|
||||
assertThat(buildLog(project)).contains("Layout: ZIP");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenALayoutIsConfiguredTheSpecifiedLayoutIsUsed(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-with-zip-layout").execute((project) -> {
|
||||
File main = new File(project, "target/jar-with-zip-layout-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(main))
|
||||
.manifest((manifest) -> manifest.hasMainClass("org.springframework.boot.loader.PropertiesLauncher")
|
||||
.hasStartClass("org.test.SampleApplication"));
|
||||
assertThat(buildLog(project)).contains("Layout: ZIP");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenRequiresUnpackConfigurationIsProvidedItIsReflectedInTheRepackagedJar(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-with-unpack").execute((project) -> {
|
||||
File main = new File(project, "target/jar-with-unpack-0.0.1.BUILD-SNAPSHOT.jar");
|
||||
assertThat(jar(main)).hasUnpackEntryWithNameStartingWith("BOOT-INF/lib/spring-core-")
|
||||
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-context-");
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenJarIsRepackagedWithACustomLayoutTheJarUsesTheLayout(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("jar-custom-layout").execute((project) -> {
|
||||
assertThat(jar(new File(project, "custom/target/custom-0.0.1.BUILD-SNAPSHOT.jar")))
|
||||
.hasEntryWithName("custom");
|
||||
assertThat(jar(new File(project, "default/target/default-0.0.1.BUILD-SNAPSHOT.jar")))
|
||||
.hasEntryWithName("sample");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.boot.maven;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.apache.maven.shared.invoker.DefaultInvocationRequest;
|
||||
import org.apache.maven.shared.invoker.DefaultInvoker;
|
||||
import org.apache.maven.shared.invoker.InvocationOutputHandler;
|
||||
import org.apache.maven.shared.invoker.InvocationRequest;
|
||||
import org.apache.maven.shared.invoker.InvocationResult;
|
||||
import org.apache.maven.shared.invoker.Invoker;
|
||||
import org.apache.maven.shared.invoker.MavenInvocationException;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.contentOf;
|
||||
|
||||
/**
|
||||
* Helper class for executing a Maven build.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*
|
||||
*/
|
||||
class MavenBuild {
|
||||
|
||||
private final File home;
|
||||
|
||||
private final File temp;
|
||||
|
||||
private final Map<String, String> pomReplacements = new HashMap<>();
|
||||
|
||||
private final List<String> goals = new ArrayList<>();
|
||||
|
||||
private final Properties properties = new Properties();
|
||||
|
||||
private File projectDir;
|
||||
|
||||
MavenBuild(File home) {
|
||||
this.home = home;
|
||||
try {
|
||||
this.temp = Files.createTempDirectory("maven-build").toFile().getCanonicalFile();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
this.pomReplacements.put("java.version", "1.8");
|
||||
this.pomReplacements.put("project.groupId", "org.springframework.boot");
|
||||
this.pomReplacements.put("project.artifactId", "spring-boot-maven-plugin");
|
||||
this.pomReplacements.put("project.version", determineVersion());
|
||||
this.pomReplacements.put("log4j2.version", "2.12.1");
|
||||
this.pomReplacements.put("maven-jar-plugin.version", "3.2.0");
|
||||
this.pomReplacements.put("maven-toolchains-plugin.version", "3.0.0");
|
||||
this.pomReplacements.put("maven-war-plugin.version", "3.2.3");
|
||||
this.pomReplacements.put("build-helper-maven-plugin.version", "3.0.0");
|
||||
this.pomReplacements.put("spring-framework.version", "5.2.1.RELEASE");
|
||||
this.pomReplacements.put("jakarta-servlet.version", "4.0.2");
|
||||
this.pomReplacements.put("kotlin.version", "1.3.60");
|
||||
}
|
||||
|
||||
MavenBuild project(String project) {
|
||||
this.projectDir = new File("src/intTest/projects/" + project);
|
||||
return this;
|
||||
}
|
||||
|
||||
MavenBuild goals(String... goals) {
|
||||
this.goals.addAll(Arrays.asList(goals));
|
||||
return this;
|
||||
}
|
||||
|
||||
MavenBuild systemProperty(String name, String value) {
|
||||
this.properties.setProperty(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
void execute(Consumer<File> callback) {
|
||||
Invoker invoker = new DefaultInvoker();
|
||||
invoker.setMavenHome(this.home);
|
||||
InvocationRequest request = new DefaultInvocationRequest();
|
||||
try {
|
||||
Path destination = this.temp.toPath();
|
||||
Path source = this.projectDir.toPath();
|
||||
Files.walkFileTree(source, new SimpleFileVisitor<Path>() {
|
||||
|
||||
@Override
|
||||
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
|
||||
Files.createDirectories(destination.resolve(source.relativize(dir)));
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
if (file.toFile().getName().equals("pom.xml")) {
|
||||
String pomXml = new String(Files.readAllBytes(file), StandardCharsets.UTF_8);
|
||||
for (Entry<String, String> replacement : MavenBuild.this.pomReplacements.entrySet()) {
|
||||
pomXml = pomXml.replace("@" + replacement.getKey() + "@", replacement.getValue());
|
||||
}
|
||||
Files.write(destination.resolve(source.relativize(file)),
|
||||
pomXml.getBytes(StandardCharsets.UTF_8), StandardOpenOption.CREATE_NEW);
|
||||
}
|
||||
else {
|
||||
Files.copy(file, destination.resolve(source.relativize(file)),
|
||||
StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
|
||||
});
|
||||
String settingsXml = new String(Files.readAllBytes(Paths.get("src", "intTest", "projects", "settings.xml")),
|
||||
StandardCharsets.UTF_8)
|
||||
.replace("@localCentralUrl@",
|
||||
new File("build/int-test-maven-repository").toURI().toURL().toString())
|
||||
.replace("@localRepositoryPath@",
|
||||
new File("build/local-maven-repository").getAbsolutePath());
|
||||
Files.write(destination.resolve("settings.xml"), settingsXml.getBytes(StandardCharsets.UTF_8),
|
||||
StandardOpenOption.CREATE_NEW);
|
||||
request.setBaseDirectory(this.temp);
|
||||
request.setProperties(this.properties);
|
||||
request.setGoals(this.goals.isEmpty() ? Collections.singletonList("package") : this.goals);
|
||||
request.setUserSettingsFile(new File(this.temp, "settings.xml"));
|
||||
request.setUpdateSnapshots(true);
|
||||
request.setBatchMode(true);
|
||||
File target = new File(this.temp, "target");
|
||||
target.mkdirs();
|
||||
File buildLogFile = new File(target, "build.log");
|
||||
try (PrintWriter buildLog = new PrintWriter(new FileWriter(buildLogFile))) {
|
||||
request.setOutputHandler(new InvocationOutputHandler() {
|
||||
|
||||
@Override
|
||||
public void consumeLine(String line) {
|
||||
buildLog.println(line);
|
||||
buildLog.flush();
|
||||
}
|
||||
|
||||
});
|
||||
try {
|
||||
InvocationResult result = invoker.execute(request);
|
||||
assertThat(result.getExitCode()).as(contentOf(buildLogFile)).isEqualTo(0);
|
||||
}
|
||||
catch (MavenInvocationException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
callback.accept(this.temp);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private String determineVersion() {
|
||||
File gradleProperties = new File("gradle.properties").getAbsoluteFile();
|
||||
while (!gradleProperties.isFile()) {
|
||||
gradleProperties = new File(gradleProperties.getParentFile().getParentFile(), "gradle.properties");
|
||||
}
|
||||
Properties properties = new Properties();
|
||||
try (Reader reader = new FileReader(gradleProperties)) {
|
||||
properties.load(reader);
|
||||
return properties.getProperty("version");
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.boot.maven;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.junit.jupiter.api.extension.Extension;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.api.extension.ParameterContext;
|
||||
import org.junit.jupiter.api.extension.ParameterResolutionException;
|
||||
import org.junit.jupiter.api.extension.ParameterResolver;
|
||||
import org.junit.jupiter.api.extension.TestTemplateInvocationContext;
|
||||
import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider;
|
||||
|
||||
/**
|
||||
* An {@link Extension} for templated tests that use {@link MavenBuild}. Each templated
|
||||
* test is run against multiple versions of Maven.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
class MavenBuildExtension implements TestTemplateInvocationContextProvider {
|
||||
|
||||
@Override
|
||||
public boolean supportsTestTemplate(ExtensionContext context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext context) {
|
||||
try {
|
||||
return Files.list(Paths.get("build/maven-binaries")).map(MavenVersionTestTemplateInvocationContext::new);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class MavenVersionTestTemplateInvocationContext implements TestTemplateInvocationContext {
|
||||
|
||||
private final Path mavenHome;
|
||||
|
||||
private MavenVersionTestTemplateInvocationContext(Path mavenHome) {
|
||||
this.mavenHome = mavenHome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName(int invocationIndex) {
|
||||
return this.mavenHome.getFileName().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Extension> getAdditionalExtensions() {
|
||||
return Arrays.asList(new MavenBuildParameterResolver(this.mavenHome));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final class MavenBuildParameterResolver implements ParameterResolver {
|
||||
|
||||
private final Path mavenHome;
|
||||
|
||||
private MavenBuildParameterResolver(Path mavenHome) {
|
||||
this.mavenHome = mavenHome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
return parameterContext.getParameter().getType().equals(MavenBuild.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
|
||||
throws ParameterResolutionException {
|
||||
return new MavenBuild(this.mavenHome.toFile());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.boot.maven;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
import org.junit.jupiter.api.condition.DisabledOnOs;
|
||||
import org.junit.jupiter.api.condition.OS;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.contentOf;
|
||||
|
||||
/**
|
||||
* Integration tests for the Maven plugin's run goal.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@ExtendWith(MavenBuildExtension.class)
|
||||
class RunIntegrationTests {
|
||||
|
||||
@TestTemplate
|
||||
void whenTheRunGoalIsExecutedTheApplicationIsForkedWithOptimizedJvmArguments(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run").goals("spring-boot:run", "-X").execute((project) -> {
|
||||
String jvmArguments = isJava13OrLater() ? "JVM argument(s): -XX:TieredStopAtLevel=1"
|
||||
: "JVM argument(s): -Xverify:none -XX:TieredStopAtLevel=1";
|
||||
assertThat(buildLog(project)).contains("I haz been run").contains(jvmArguments);
|
||||
});
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenForkingIsDisabledAndDevToolsIsPresentDevToolsIsDisabled(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-devtools").goals("spring-boot:run").execute((project) -> assertThat(buildLog(project))
|
||||
.contains("I haz been run").contains("Fork mode disabled, devtools will be disabled"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenForkingIsDisabledJvmArgumentsAndWorkingDirectoryAreIgnored(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-disable-fork").goals("spring-boot:run")
|
||||
.execute((project) -> assertThat(buildLog(project)).contains("I haz been run").contains(
|
||||
"Fork mode disabled, ignoring JVM argument(s) [-Dproperty1=value1 -Dproperty2 -Dfoo=bar]")
|
||||
.contains("Fork mode disabled, ignoring working directory configuration"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenEnvironmentVariablesAreConfiguredTheyAreAvailableToTheApplication(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-envargs").goals("spring-boot:run")
|
||||
.execute((project) -> assertThat(buildLog(project)).contains("I haz been run"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenExclusionsAreConfiguredExcludedDependenciesDoNotAppearOnTheClasspath(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-exclude").goals("spring-boot:run")
|
||||
.execute((project) -> assertThat(buildLog(project)).contains("I haz been run"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenSystemPropertiesAreConfiguredTheyAreAvailableToTheApplication(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-jvm-system-props").goals("spring-boot:run")
|
||||
.execute((project) -> assertThat(buildLog(project)).contains("I haz been run"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenJvmArgumentsAreConfiguredTheyAreAvailableToTheApplication(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-jvmargs").goals("spring-boot:run")
|
||||
.execute((project) -> assertThat(buildLog(project)).contains("I haz been run"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenProfilesAreConfiguredTheyArePassedToTheApplication(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-profiles").goals("spring-boot:run", "-X").execute(
|
||||
(project) -> assertThat(buildLog(project)).contains("I haz been run with profile(s) 'foo,bar'"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenProfilesAreConfiguredAndForkingIsDisabledTheyArePassedToTheApplication(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-profiles-fork-disabled").goals("spring-boot:run").execute(
|
||||
(project) -> assertThat(buildLog(project)).contains("I haz been run with profile(s) 'foo,bar'"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenUseTestClasspathIsEnabledTheApplicationHasTestDependenciesOnItsClasspath(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-use-test-classpath").goals("spring-boot:run")
|
||||
.execute((project) -> assertThat(buildLog(project)).contains("I haz been run"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenAWorkingDirectoryIsConfiguredTheApplicationIsRunFromThatDirectory(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-working-directory").goals("spring-boot:run")
|
||||
.execute((project) -> assertThat(buildLog(project)).contains("I haz been run"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
@DisabledOnOs(OS.WINDOWS)
|
||||
void whenAToolchainIsConfiguredItIsUsedToRunTheApplication(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-toolchains").goals("verify", "-t", "toolchains.xml")
|
||||
.execute((project) -> assertThat(buildLog(project)).contains("The Maven Toolchains is awesome!"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenPomSpecifiesRunArgumentsContainingCommasTheyArePassedToTheApplicationCorrectly(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-arguments").goals("spring-boot:run").execute((project) -> assertThat(buildLog(project))
|
||||
.contains("I haz been run with profile(s) 'foo,bar' and endpoint(s) 'prometheus,info'"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenCommandLineSpecifiesRunArgumentsContainingCommasTheyArePassedToTheApplicationCorrectly(
|
||||
MavenBuild mavenBuild) {
|
||||
mavenBuild.project("run-arguments-commandline").goals("spring-boot:run").systemProperty(
|
||||
"spring-boot.run.arguments",
|
||||
"--management.endpoints.web.exposure.include=prometheus,info,health,metrics --spring.profiles.active=foo,bar")
|
||||
.execute((project) -> assertThat(buildLog(project)).contains(
|
||||
"I haz been run with profile(s) 'foo,bar' and endpoint(s) 'prometheus,info,health,metrics'"));
|
||||
}
|
||||
|
||||
private String buildLog(File project) {
|
||||
return contentOf(new File(project, "target/build.log"));
|
||||
}
|
||||
|
||||
private boolean isJava13OrLater() {
|
||||
for (Method method : String.class.getMethods()) {
|
||||
if (method.getName().equals("stripIndent")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.boot.maven;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.contentOf;
|
||||
|
||||
/**
|
||||
* Integration tests for the Maven plugin's war support.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@ExtendWith(MavenBuildExtension.class)
|
||||
class StartStopIntegrationTests {
|
||||
|
||||
@TestTemplate
|
||||
void startStopWithForkDisabledWaitsForApplicationToBeReadyAndThenRequestsShutdown(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("start-stop-fork-disabled").goals("verify").execute(
|
||||
(project) -> assertThat(buildLog(project)).contains("isReady: true").contains("Shutdown requested"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void startStopWaitsForApplicationToBeReadyAndThenRequestsShutdown(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("start-stop").goals("verify").execute(
|
||||
(project) -> assertThat(buildLog(project)).contains("isReady: true").contains("Shutdown requested"));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenSkipIsTrueStartAndStopAreSkipped(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("start-stop-skip").goals("verify").execute((project) -> assertThat(buildLog(project))
|
||||
.doesNotContain("Ooops, I haz been run").doesNotContain("Stopping application"));
|
||||
}
|
||||
|
||||
private String buildLog(File project) {
|
||||
return contentOf(new File(project, "target/build.log"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.boot.maven;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.jupiter.api.TestTemplate;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for the Maven plugin's war support.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@ExtendWith(MavenBuildExtension.class)
|
||||
class WarIntegrationTests extends AbstractArchiveIntegrationTests {
|
||||
|
||||
@TestTemplate
|
||||
void warRepackaging(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("war")
|
||||
.execute((project) -> assertThat(jar(new File(project, "target/war-0.0.1.BUILD-SNAPSHOT.war")))
|
||||
.hasEntryWithNameStartingWith("WEB-INF/lib/spring-context")
|
||||
.hasEntryWithNameStartingWith("WEB-INF/lib/spring-core")
|
||||
.hasEntryWithNameStartingWith("WEB-INF/lib/spring-jcl")
|
||||
.hasEntryWithNameStartingWith("WEB-INF/lib-provided/jakarta.servlet-api-4")
|
||||
.hasEntryWithName("org/springframework/boot/loader/WarLauncher.class")
|
||||
.hasEntryWithName("WEB-INF/classes/org/test/SampleApplication.class")
|
||||
.hasEntryWithName("index.html")
|
||||
.manifest((manifest) -> manifest.hasMainClass("org.springframework.boot.loader.WarLauncher")
|
||||
.hasStartClass("org.test.SampleApplication").hasAttribute("Not-Used", "Foo")));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void jarDependencyWithCustomFinalNameBuiltInSameReactorIsPackagedUsingArtifactIdAndVersion(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("war-reactor")
|
||||
.execute(((project) -> assertThat(jar(new File(project, "war/target/war-0.0.1.BUILD-SNAPSHOT.war")))
|
||||
.hasEntryWithName("WEB-INF/lib/jar-0.0.1.BUILD-SNAPSHOT.jar")
|
||||
.doesNotHaveEntryWithName("WEB-INF/lib/jar.jar")));
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void whenRequiresUnpackConfigurationIsProvidedItIsReflectedInTheRepackagedWar(MavenBuild mavenBuild) {
|
||||
mavenBuild.project("war-with-unpack").execute(
|
||||
(project) -> assertThat(jar(new File(project, "target/war-with-unpack-0.0.1.BUILD-SNAPSHOT.war")))
|
||||
.hasUnpackEntryWithNameStartingWith("WEB-INF/lib/spring-core-")
|
||||
.hasEntryWithNameStartingWith("WEB-INF/lib/spring-context-")
|
||||
.hasEntryWithNameStartingWith("WEB-INF/lib/spring-jcl-"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>build-info-additional-properties</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<name>Generate build info</name>
|
||||
<name>Generate build info with additional properties</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
@@ -34,17 +34,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>@spring-framework.version@</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>@jakarta-servlet.version@</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -3,15 +3,14 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>run-devtools</artifactId>
|
||||
<artifactId>build-info-custom-build-time</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<name>Generate build info with custom build time</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<!-- Devtools cannot be added here but the project has the class
|
||||
that the code is looking for -->
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -20,13 +19,12 @@
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<fork>false</fork>
|
||||
<time>2019-07-08T08:00:00Z</time>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>build-info</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>build-info-custom-file</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<name>Generate custom build info</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>build-info</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputFile>${project.build.directory}/build.info</outputFile>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>build-info</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<name>Generate build info</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>build-info</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -3,7 +3,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>run</artifactId>
|
||||
<artifactId>jar-attach-disabled</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -18,12 +18,11 @@
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<fork>false</fork>
|
||||
<attach>false</attach>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>jar-classifier-main-attach-disabled</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<classifier>test</classifier>
|
||||
<attach>false</attach>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>jar-classifier-main</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<classifier>test</classifier>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -24,11 +24,6 @@
|
||||
<phase>package</phase>
|
||||
<configuration>
|
||||
<classifier>test</classifier>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Not-Used>Foo</Not-Used>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -51,17 +46,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>@spring-framework.version@</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>@jakarta-servlet.version@</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -24,11 +24,6 @@
|
||||
<phase>package</phase>
|
||||
<configuration>
|
||||
<classifier>test</classifier>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Not-Used>Foo</Not-Used>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -50,17 +45,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>@spring-framework.version@</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>@jakarta-servlet.version@</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>jar-create-dir</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/foo</outputDirectory>
|
||||
<classifier>foo</classifier>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -3,7 +3,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>run-jvmargs</artifactId>
|
||||
<artifactId>jar-custom-dir</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -18,12 +18,11 @@
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<jvmArguments>-Dfoo="value 1" -Dbar=value2</jvmArguments>
|
||||
<outputDirectory>${project.build.directory}/foo</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>jar</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<embeddedLaunchScript>${basedir}/src/launcher/custom.script</embeddedLaunchScript>
|
||||
<embeddedLaunchScriptProperties>
|
||||
<name>world</name>
|
||||
</embeddedLaunchScriptProperties>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -3,37 +3,41 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>run-jvmargs</artifactId>
|
||||
<artifactId>custom</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<jvmArguments>-Dfoo="value 1" -Dbar=value2</jvmArguments>
|
||||
<systemPropertyVariables>
|
||||
<property1>value1</property1>
|
||||
<property2/>
|
||||
<property3>${project.artifactId}</property3>
|
||||
<foo>should-be-ignored</foo>
|
||||
</systemPropertyVariables>
|
||||
<layoutFactory implementation="smoketest.layout.SampleLayoutFactory">
|
||||
<name>custom</name>
|
||||
</layoutFactory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>layout</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>default</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>layout</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>jar-custom-layout</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>layout</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-loader-tools</artifactId>
|
||||
<version>@project.version@</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 smoketest.layout;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.springframework.boot.loader.tools.CustomLoaderLayout;
|
||||
import org.springframework.boot.loader.tools.Layouts;
|
||||
import org.springframework.boot.loader.tools.LoaderClassesWriter;
|
||||
|
||||
/**
|
||||
* An example layout.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
public class SampleLayout extends Layouts.Jar implements CustomLoaderLayout {
|
||||
|
||||
private String name;
|
||||
|
||||
public SampleLayout(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeLoadedClasses(LoaderClassesWriter writer) throws IOException {
|
||||
writer.writeEntry(this.name, new ByteArrayInputStream("test".getBytes()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,14 +14,35 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import org.springframework.boot.maven.*;
|
||||
package smoketest.layout;
|
||||
|
||||
File f = new File(basedir, "target/jar-exclude-entry-0.0.1.BUILD-SNAPSHOT.jar")
|
||||
new Verify.JarArchiveVerification(f, Verify.SAMPLE_APP) {
|
||||
@Override
|
||||
protected void verifyZipEntries(Verify.ArchiveVerifier verifier) throws Exception {
|
||||
super.verifyZipEntries(verifier)
|
||||
verifier.assertHasNoEntryNameStartingWith("BOOT-INF/lib/servlet-api-2.5.jar")
|
||||
import java.io.File;
|
||||
|
||||
import org.springframework.boot.loader.tools.Layout;
|
||||
import org.springframework.boot.loader.tools.LayoutFactory;
|
||||
|
||||
public class SampleLayoutFactory implements LayoutFactory {
|
||||
|
||||
private String name = "sample";
|
||||
|
||||
public SampleLayoutFactory() {
|
||||
}
|
||||
}.verify()
|
||||
|
||||
public SampleLayoutFactory(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Layout getLayout(File source) {
|
||||
return new SampleLayout(this.name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
org.springframework.boot.loader.tools.LayoutFactory=\
|
||||
smoketest.layout.SampleLayoutFactory
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>jar-custom-layout</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<modules>
|
||||
<module>layout</module>
|
||||
<module>custom</module>
|
||||
<module>default</module>
|
||||
</modules>
|
||||
</project>
|
||||
@@ -3,9 +3,8 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>build-info-custom-file</artifactId>
|
||||
<artifactId>jar-exclude-entry</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<name>Generate custom build info</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
@@ -20,10 +19,15 @@
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>build-info</goal>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputFile>${project.build.directory}/build.info</outputFile>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -37,9 +41,9 @@
|
||||
<version>@spring-framework.version@</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>@jakarta-servlet.version@</version>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -47,12 +47,6 @@
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>@spring-framework.version@</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>@jakarta-servlet.version@</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
@@ -38,25 +38,9 @@
|
||||
<manifest>
|
||||
<mainClass>some.random.Main</mainClass>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Not-Used>Foo</Not-Used>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>@spring-framework.version@</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>@jakarta-servlet.version@</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -10,11 +10,4 @@
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>@spring-framework.version@</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -24,18 +24,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>@maven-jar-plugin.version@</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Not-Used>Foo</Not-Used>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
@@ -50,11 +38,5 @@
|
||||
<artifactId>acme-lib</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>@jakarta-servlet.version@</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -25,17 +25,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>@spring-framework.version@</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>@jakarta-servlet.version@</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -21,7 +21,7 @@
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>jar-system-scope-default</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>sample</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/sample-1.0.0.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -3,7 +3,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>run-disable-fork</artifactId>
|
||||
<artifactId>jar-system-scope</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -18,22 +18,24 @@
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<fork>false</fork>
|
||||
<jvmArguments>-Dfoo=bar</jvmArguments>
|
||||
<workingDirectory>${project.build.sourceDirectory}</workingDirectory>
|
||||
<systemPropertyVariables>
|
||||
<property1>value1</property1>
|
||||
<property2/>
|
||||
</systemPropertyVariables>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>sample</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/sample-1.0.0.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -3,9 +3,8 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>build-info</artifactId>
|
||||
<artifactId>jar-test-scope</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<name>Generate build info</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
@@ -20,7 +19,7 @@
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>build-info</goal>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -34,10 +33,10 @@
|
||||
<version>@spring-framework.version@</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>@jakarta-servlet.version@</version>
|
||||
<scope>provided</scope>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>@log4j2.version@</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -23,29 +23,9 @@
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<requiresUnpack>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-compiler</artifactId>
|
||||
</dependency>
|
||||
</requiresUnpack>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>@maven-jar-plugin.version@</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Not-Used>Foo</Not-Used>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
@@ -70,23 +50,6 @@
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>@spring-framework.version@</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>@jakarta-servlet.version@</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>@log4j2.version@</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
@@ -3,7 +3,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>run-working-directory</artifactId>
|
||||
<artifactId>jar-with-zip-layout</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -18,12 +18,11 @@
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<workingDirectory>${project.build.sourceDirectory}</workingDirectory>
|
||||
<layout>ZIP</layout>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -16,14 +16,6 @@
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
@@ -16,20 +16,12 @@
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>
|
||||
<argument>--management.endpoints.web.exposure.include=prometheus,info</argument>
|
||||
<argument>--spring.profiles.active=foo,bar</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<arguments>
|
||||
<argument>--management.endpoints.web.exposure.include=prometheus,info</argument>
|
||||
<argument>--spring.profiles.active=foo,bar</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>run-devtools</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<!-- Devtools cannot be added here but the project has the class
|
||||
that the code is looking for -->
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<configuration>
|
||||
<fork>false</fork>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>run-disable-fork</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<configuration>
|
||||
<fork>false</fork>
|
||||
<jvmArguments>-Dfoo=bar</jvmArguments>
|
||||
<workingDirectory>${project.build.sourceDirectory}</workingDirectory>
|
||||
<systemPropertyVariables>
|
||||
<property1>value1</property1>
|
||||
<property2/>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -16,22 +16,14 @@
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<environmentVariables>
|
||||
<ENV1>5000</ENV1>
|
||||
<ENV2>Some Text</ENV2>
|
||||
<ENV3/>
|
||||
<ENV4></ENV4>
|
||||
</environmentVariables>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<environmentVariables>
|
||||
<ENV1>5000</ENV1>
|
||||
<ENV2>Some Text</ENV2>
|
||||
<ENV3/>
|
||||
<ENV4></ENV4>
|
||||
</environmentVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
@@ -16,23 +16,15 @@
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
<excludeGroupIds>jakarta.servlet,javax.servlet</excludeGroupIds>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
<excludeGroupIds>jakarta.servlet,javax.servlet</excludeGroupIds>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>run-jvmargs</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>@java.version@</maven.compiler.source>
|
||||
<maven.compiler.target>@java.version@</maven.compiler.target>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<configuration>
|
||||
<jvmArguments>-Dfoo="value 1" -Dbar=value2</jvmArguments>
|
||||
<systemPropertyVariables>
|
||||
<property1>value1</property1>
|
||||
<property2/>
|
||||
<property3>${project.artifactId}</property3>
|
||||
<foo>should-be-ignored</foo>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user