Skip to content

Commit 67f11fa

Browse files
nigredo-torislandelle
authored andcommitted
Add maven.main.skip support
1 parent 1c06a63 commit 67f11fa

File tree

12 files changed

+143
-0
lines changed

12 files changed

+143
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.goals=clean test-compile -e -Dmaven.main.skip=true

src/it/test_skip_main/pom.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>it.scala-maven-plugin</groupId>
8+
<artifactId>test_skip_test</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<name>Test for skipping compilation of test sources</name>
11+
<description>Test for skipping compilation of test sources</description>
12+
<packaging>pom</packaging>
13+
<dependencies>
14+
<dependency>
15+
<groupId>org.scala-lang</groupId>
16+
<artifactId>scala-library</artifactId>
17+
<version>${scala.version.lastrelease}</version>
18+
</dependency>
19+
</dependencies>
20+
21+
<build>
22+
<plugins>
23+
<plugin>
24+
<groupId>@project.groupId@</groupId>
25+
<artifactId>@project.artifactId@</artifactId>
26+
<version>@project.version@</version>
27+
<executions>
28+
<execution>
29+
<id>scala-compile-first</id>
30+
<goals>
31+
<goal>compile</goal>
32+
</goals>
33+
</execution>
34+
<execution>
35+
<id>scala-test-compile</id>
36+
<goals>
37+
<goal>testCompile</goal>
38+
</goals>
39+
</execution>
40+
</executions>
41+
</plugin>
42+
</plugins>
43+
</build>
44+
45+
</project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class Main
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class Test

src/it/test_skip_main/validate.groovy

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
try {
2+
3+
def mainFile = new File(basedir, 'target/classes/Main.class')
4+
assert !mainFile.exists()
5+
6+
def testFile = new File(basedir, 'target/test-classes/Test.class')
7+
assert testFile.exists()
8+
9+
return true
10+
11+
} catch(Throwable e) {
12+
e.printStackTrace()
13+
return false
14+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.goals=clean test-compile -e -Dmaven.test.skip=true

src/it/test_skip_test/pom.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>it.scala-maven-plugin</groupId>
8+
<artifactId>test_skip_test</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<name>Test for skipping compilation of test sources</name>
11+
<description>Test for skipping compilation of test sources</description>
12+
<packaging>pom</packaging>
13+
<dependencies>
14+
<dependency>
15+
<groupId>org.scala-lang</groupId>
16+
<artifactId>scala-library</artifactId>
17+
<version>${scala.version.lastrelease}</version>
18+
</dependency>
19+
</dependencies>
20+
21+
<build>
22+
<plugins>
23+
<plugin>
24+
<groupId>@project.groupId@</groupId>
25+
<artifactId>@project.artifactId@</artifactId>
26+
<version>@project.version@</version>
27+
<executions>
28+
<execution>
29+
<id>scala-compile-first</id>
30+
<goals>
31+
<goal>compile</goal>
32+
</goals>
33+
</execution>
34+
<execution>
35+
<id>scala-test-compile</id>
36+
<goals>
37+
<goal>testCompile</goal>
38+
</goals>
39+
</execution>
40+
</executions>
41+
</plugin>
42+
</plugins>
43+
</build>
44+
45+
</project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class Main
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class Test

src/it/test_skip_test/validate.groovy

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
try {
2+
3+
def mainFile = new File(basedir, 'target/classes/Main.class')
4+
assert mainFile.exists()
5+
6+
def testFile = new File(basedir, 'target/test-classes/Test.class')
7+
assert !testFile.exists()
8+
9+
return true
10+
11+
} catch(Throwable e) {
12+
e.printStackTrace()
13+
return false
14+
}

0 commit comments

Comments
 (0)