14 changed files with 280 additions and 54 deletions
@ -1,20 +1,18 @@
@@ -1,20 +1,18 @@
|
||||
import java.io.*; |
||||
import org.springframework.boot.maven.* |
||||
|
||||
import static org.junit.Assert.assertTrue; |
||||
import static org.junit.Assert.assertTrue |
||||
import static org.junit.Assert.assertFalse |
||||
|
||||
Verify.verifyJar( |
||||
new File( basedir, "target/jar-attach-disabled-0.0.1.BUILD-SNAPSHOT.jar" ), "some.random.Main" |
||||
); |
||||
File main = new File( basedir, "target/jar-attach-disabled-0.0.1.BUILD-SNAPSHOT.jar") |
||||
File backup = new File( basedir, "target/jar-attach-disabled-0.0.1.BUILD-SNAPSHOT.jar.original") |
||||
File main = new File(basedir, "target/jar-attach-disabled-0.0.1.BUILD-SNAPSHOT.jar") |
||||
File backup = new File(basedir, "target/jar-attach-disabled-0.0.1.BUILD-SNAPSHOT.jar.original") |
||||
Verify.verifyJar(main, "some.random.Main") |
||||
assertTrue 'backup file should exist', backup.exists() |
||||
|
||||
|
||||
def file = new File(basedir, "build.log") |
||||
assertTrue 'main artifact should have been updated', |
||||
file.text.contains("Updating artifact " + main + " to " + backup) |
||||
return file.text.contains ("Installing "+backup) |
||||
|
||||
|
||||
file.text.contains("Updating main artifact " + main + " to " + backup) |
||||
assertTrue 'main artifact should have been installed', |
||||
file.text.contains ("Installing " + backup + " to") |
||||
assertFalse 'repackaged artifact should not have been installed', |
||||
file.text.contains ("Installing " + main + "to") |
||||
|
||||
|
||||
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
invoker.goals=clean install |
||||
@ -0,0 +1,58 @@
@@ -0,0 +1,58 @@
|
||||
<?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 http://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> |
||||
<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> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-context</artifactId> |
||||
<version>@spring.version@</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>javax.servlet</groupId> |
||||
<artifactId>javax.servlet-api</artifactId> |
||||
<version>@servlet-api.version@</version> |
||||
<scope>provided</scope> |
||||
</dependency> |
||||
</dependencies> |
||||
</project> |
||||
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
/* |
||||
* Copyright 2012-2018 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 |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.test; |
||||
|
||||
public class SampleApplication { |
||||
|
||||
public static void main(String[] args) { |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
import org.springframework.boot.maven.* |
||||
|
||||
import static org.junit.Assert.assertTrue |
||||
import static org.junit.Assert.assertFalse |
||||
|
||||
File repackaged = new File(basedir, "target/jar-classifier-main-attach-disabled-0.0.1.BUILD-SNAPSHOT-test.jar") |
||||
File main = new File( basedir, "target/jar-classifier-main-attach-disabled-0.0.1.BUILD-SNAPSHOT.jar") |
||||
File backup = new File( basedir, "target/jar-classifier-main-attach-disabled-0.0.1.BUILD-SNAPSHOT.jar.original") |
||||
|
||||
new Verify.JarArchiveVerification(repackaged, Verify.SAMPLE_APP).verify(); |
||||
assertTrue 'main artifact should exist', main.exists() |
||||
assertFalse 'backup artifact should not exist', backup.exists() |
||||
|
||||
def file = new File(basedir, "build.log") |
||||
assertFalse 'repackaged artifact should not have been attached', |
||||
file.text.contains("Attaching repackaged archive " + repackaged + " with classifier test") |
||||
assertTrue 'repackaged artifact should have been created', |
||||
file.text.contains("Creating repackaged archive " + repackaged + " with classifier test") |
||||
assertTrue 'main artifact should have been installed', |
||||
file.text.contains ("Installing " + main + " to") |
||||
assertFalse 'repackaged artifact should not have been installed', |
||||
file.text.contains ("Installing " + repackaged + " to") |
||||
assertFalse 'backup artifact should not have been installed', |
||||
file.text.contains ("Installing " + backup + "to") |
||||
|
||||
|
||||
|
||||
@ -1,20 +1,22 @@
@@ -1,20 +1,22 @@
|
||||
import java.io.*; |
||||
import org.springframework.boot.maven.*; |
||||
import org.springframework.boot.maven.* |
||||
|
||||
import static org.junit.Assert.assertTrue; |
||||
import static org.junit.Assert.assertFalse; |
||||
import static org.junit.Assert.assertTrue |
||||
import static org.junit.Assert.assertFalse |
||||
|
||||
File repackaged = new File(basedir, "target/jar-classifier-main-0.0.1.BUILD-SNAPSHOT-test.jar") |
||||
new Verify.JarArchiveVerification(repackaged, Verify.SAMPLE_APP).verify(); |
||||
|
||||
File main = new File( basedir, "target/jar-classifier-main-0.0.1.BUILD-SNAPSHOT.jar") |
||||
assertTrue 'main artifact should exist', main.exists() |
||||
|
||||
File backup = new File( basedir, "target/jar-classifier-main-0.0.1.BUILD-SNAPSHOT.jar.original") |
||||
|
||||
new Verify.JarArchiveVerification(repackaged, Verify.SAMPLE_APP).verify(); |
||||
assertTrue 'main artifact should exist', main.exists() |
||||
assertFalse 'backup artifact should not exist', backup.exists() |
||||
|
||||
def file = new File(basedir, "build.log") |
||||
assertTrue 'repackaged artifact should have been attached', file.text.contains("Attaching archive " + repackaged) |
||||
assertTrue 'main artifact should have been installed', file.text.contains ("Installing "+main) |
||||
assertTrue 'repackaged artifact should have been installed', file.text.contains ("Installing "+repackaged) |
||||
|
||||
assertTrue 'repackaged artifact should have been attached', |
||||
file.text.contains("Attaching repackaged archive " + repackaged + " with classifier test") |
||||
assertFalse 'repackaged artifact should have been created', |
||||
file.text.contains("Creating repackaged archive " + repackaged + " with classifier test") |
||||
assertTrue 'main artifact should have been installed', |
||||
file.text.contains ("Installing " + main + " to") |
||||
assertTrue 'repackaged artifact should have been installed', |
||||
file.text.contains ("Installing " + repackaged + " to") |
||||
|
||||
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
invoker.goals=clean install |
||||
@ -0,0 +1,67 @@
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<groupId>org.springframework.boot.maven.it</groupId> |
||||
<artifactId>jar-classifier-source-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>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-jar-plugin</artifactId> |
||||
<version>@maven-jar-plugin.version@</version> |
||||
<executions> |
||||
<execution> |
||||
<goals> |
||||
<goal>jar</goal> |
||||
</goals> |
||||
<phase>package</phase> |
||||
<configuration> |
||||
<classifier>test</classifier> |
||||
<archive> |
||||
<manifestEntries> |
||||
<Not-Used>Foo</Not-Used> |
||||
</manifestEntries> |
||||
</archive> |
||||
</configuration> |
||||
</execution> |
||||
</executions> |
||||
</plugin> |
||||
<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> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-context</artifactId> |
||||
<version>@spring.version@</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>javax.servlet</groupId> |
||||
<artifactId>javax.servlet-api</artifactId> |
||||
<version>@servlet-api.version@</version> |
||||
<scope>provided</scope> |
||||
</dependency> |
||||
</dependencies> |
||||
</project> |
||||
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
/* |
||||
* Copyright 2012-2018 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 |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.test; |
||||
|
||||
public class SampleApplication { |
||||
|
||||
public static void main(String[] args) { |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
import org.springframework.boot.maven.* |
||||
|
||||
import static org.junit.Assert.assertTrue |
||||
import static org.junit.Assert.assertFalse |
||||
|
||||
File main = new File(basedir, "target/jar-classifier-source-attach-disabled-0.0.1.BUILD-SNAPSHOT-test.jar"); |
||||
File backup = new File( basedir, "target/jar-classifier-source-attach-disabled-0.0.1.BUILD-SNAPSHOT-test.jar.original") |
||||
|
||||
new Verify.JarArchiveVerification(main, Verify.SAMPLE_APP).verify(); |
||||
assertTrue 'backup artifact should exist', backup.exists() |
||||
|
||||
def file = new File(basedir, "build.log") |
||||
assertFalse 'repackaged artifact should not have been attached', |
||||
file.text.contains("Attaching repackaged archive " + main + " with classifier test") |
||||
assertTrue 'test artifact should have been updated', |
||||
file.text.contains("Updating artifact with classifier test " + main + " to " + backup) |
||||
assertTrue 'backup artifact should have been installed', |
||||
file.text.contains ("Installing " + backup + " to") |
||||
assertFalse 'repackaged artifact should not have been installed', |
||||
file.text.contains ("Installing " + main + " to") |
||||
|
||||
@ -1,33 +1,17 @@
@@ -1,33 +1,17 @@
|
||||
/* |
||||
* Copyright 2012-2014 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 |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
import java.io.*; |
||||
import org.springframework.boot.maven.* |
||||
|
||||
import static org.junit.Assert.assertFalse |
||||
import static org.junit.Assert.assertTrue; |
||||
import static org.junit.Assert.assertTrue |
||||
|
||||
File repackaged = new File(basedir, "target/jar-classifier-source-0.0.1.BUILD-SNAPSHOT-test.jar"); |
||||
new Verify.JarArchiveVerification(repackaged, Verify.SAMPLE_APP).verify(); |
||||
|
||||
File backup = new File( basedir, "target/jar-classifier-source-0.0.1.BUILD-SNAPSHOT-test.jar.original") |
||||
|
||||
new Verify.JarArchiveVerification(repackaged, Verify.SAMPLE_APP).verify(); |
||||
assertTrue 'backup artifact should exist', backup.exists() |
||||
|
||||
def file = new File(basedir, "build.log") |
||||
assertTrue 'repackaged artifact should have been replaced', file.text.contains("Replacing artifact with classifier test " + repackaged) |
||||
assertTrue 'repackaged artifact should have been replaced', |
||||
file.text.contains("Replacing artifact with classifier test with repackaged archive") |
||||
assertFalse 'backup artifact should not have been installed', file.text.contains ("Installing "+backup) |
||||
assertTrue 'repackaged artifact should have been installed', file.text.contains ("Installing "+repackaged) |
||||
|
||||
|
||||
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
invoker.goals=clean install |
||||
@ -1,7 +1,18 @@
@@ -1,7 +1,18 @@
|
||||
import java.io.*; |
||||
import org.springframework.boot.maven.*; |
||||
import org.springframework.boot.maven.* |
||||
|
||||
Verify.verifyJar( |
||||
new File( basedir, "target/jar-0.0.1.BUILD-SNAPSHOT.jar" ), "some.random.Main" |
||||
); |
||||
import static org.junit.Assert.assertTrue |
||||
import static org.junit.Assert.assertFalse |
||||
|
||||
File main = new File(basedir, "target/jar-0.0.1.BUILD-SNAPSHOT.jar") |
||||
File backup = new File(basedir, "target/jar-0.0.1.BUILD-SNAPSHOT.jar.original") |
||||
Verify.verifyJar(main, "some.random.Main") |
||||
assertTrue 'backup file should exist', backup.exists() |
||||
|
||||
def file = new File(basedir, "build.log") |
||||
assertTrue 'main artifact should have been replaced by repackaged archive', |
||||
file.text.contains("Replacing main artifact with repackaged archive") |
||||
assertTrue 'main artifact should have been installed', |
||||
file.text.contains ("Installing " + main + " to") |
||||
assertFalse 'backup artifact should not have been installed', |
||||
file.text.contains ("Installing " + backup + "to") |
||||
|
||||
|
||||
Loading…
Reference in new issue