Skip to content

Commit 4af43a4

Browse files
author
Nguyen Nam Thai
committed
Core Maven Plugins
1 parent 8441d41 commit 4af43a4

9 files changed

Lines changed: 174 additions & 0 deletions

File tree

‎maven/.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/output-resources

‎maven/input-resources/baeldung.png‎

4.22 KB
Loading

‎maven/input-resources/baeldung.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Welcome to ${resources.name}!
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<verifications xmlns="http://maven.apache.org/verifications/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/verifications/1.0.0 http://maven.apache.org/xsd/verifications-1.0.0.xsd">
3+
<files>
4+
<file>
5+
<location>input-resources/baeldung.txt</location>
6+
<contains>Welcome</contains>
7+
</file>
8+
</files>
9+
</verifications>

‎maven/pom.xml‎

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.baeldung</groupId>
5+
<artifactId>maven</artifactId>
6+
<version>0.0.1-SNAPSHOT</version>
7+
8+
<parent>
9+
<artifactId>parent-modules</artifactId>
10+
<groupId>com.baeldung</groupId>
11+
<version>1.0.0-SNAPSHOT</version>
12+
</parent>
13+
14+
<properties>
15+
<maven.resources.version>3.0.2</maven.resources.version>
16+
<maven.compiler.version>3.7.0</maven.compiler.version>
17+
<maven.surefire.version>2.21.0</maven.surefire.version>
18+
<maven.failsafe.version>2.21.0</maven.failsafe.version>
19+
<maven.verifier.version>1.1</maven.verifier.version>
20+
<maven.clean.version>3.0.0</maven.clean.version>
21+
<resources.name>Baeldung</resources.name>
22+
</properties>
23+
24+
<dependencies>
25+
<dependency>
26+
<groupId>junit</groupId>
27+
<artifactId>junit</artifactId>
28+
<version>4.12</version>
29+
<scope>test</scope>
30+
</dependency>
31+
</dependencies>
32+
33+
<build>
34+
<plugins>
35+
<plugin>
36+
<artifactId>maven-resources-plugin</artifactId>
37+
<version>${maven.resources.version}</version>
38+
<configuration>
39+
<outputDirectory>output-resources</outputDirectory>
40+
<resources>
41+
<resource>
42+
<directory>input-resources</directory>
43+
<excludes>
44+
<exclude>*.png</exclude>
45+
</excludes>
46+
<filtering>true</filtering>
47+
</resource>
48+
</resources>
49+
</configuration>
50+
</plugin>
51+
<plugin>
52+
<artifactId>maven-compiler-plugin</artifactId>
53+
<version>${maven.compiler.version}</version>
54+
<configuration>
55+
<source>1.8</source>
56+
<target>1.8</target>
57+
<compilerArgs>
58+
<arg>-Xlint:unchecked</arg>
59+
</compilerArgs>
60+
</configuration>
61+
</plugin>
62+
<plugin>
63+
<artifactId>maven-surefire-plugin</artifactId>
64+
<version>${maven.surefire.version}</version>
65+
<configuration>
66+
<excludes>
67+
<exclude>DataTest.java</exclude>
68+
</excludes>
69+
<includes>
70+
<include>DataCheck.java</include>
71+
</includes>
72+
</configuration>
73+
</plugin>
74+
<plugin>
75+
<artifactId>maven-failsafe-plugin</artifactId>
76+
<version>${maven.failsafe.version}</version>
77+
<executions>
78+
<execution>
79+
<goals>
80+
<goal>integration-test</goal>
81+
<goal>verify</goal>
82+
</goals>
83+
<configuration>
84+
<!-- configuration similar to surefire -->
85+
</configuration>
86+
</execution>
87+
</executions>
88+
</plugin>
89+
<plugin>
90+
<artifactId>maven-verifier-plugin</artifactId>
91+
<version>${maven.verifier.version}</version>
92+
<configuration>
93+
<verificationFile>input-resources/verifications.xml</verificationFile>
94+
</configuration>
95+
<executions>
96+
<execution>
97+
<goals>
98+
<goal>verify</goal>
99+
</goals>
100+
</execution>
101+
</executions>
102+
</plugin>
103+
<plugin>
104+
<artifactId>maven-clean-plugin</artifactId>
105+
<version>${maven.clean.version}</version>
106+
<configuration>
107+
<filesets>
108+
<fileset>
109+
<directory>output-resources</directory>
110+
</fileset>
111+
</filesets>
112+
</configuration>
113+
</plugin>
114+
</plugins>
115+
</build>
116+
</project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.baeldung.maven.plugins;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class Data {
7+
List<String> textList = new ArrayList();
8+
9+
public void addText(String text) {
10+
textList.add(text);
11+
}
12+
13+
public List getTextList() {
14+
return this.textList;
15+
}
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.baeldung.maven.plugins;
2+
3+
import static org.junit.Assert.assertNotNull;
4+
5+
import org.junit.Test;
6+
7+
import com.baeldung.maven.plugins.Data;
8+
9+
public class DataCheck {
10+
@Test
11+
public void whenDataObjectIsCreated_thenItIsNotNull() {
12+
Data data = new Data();
13+
assertNotNull(data);
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.baeldung.maven.plugins;
2+
3+
import static org.junit.Assert.assertNull;
4+
5+
import org.junit.Test;
6+
7+
import com.baeldung.maven.plugins.Data;
8+
9+
public class DataTest {
10+
@Test
11+
public void whenDataObjectIsNotCreated_thenItIsNull() {
12+
Data data = null;
13+
assertNull(data);
14+
}
15+
}

‎pom.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
<!-- <module>kotlin</module> -->
123123
<module>mapstruct</module>
124124
<!-- <module>metrics</module> -->
125+
<module>maven</module>
125126
<module>mesos-marathon</module>
126127
<module>testing-modules/mockito</module>
127128
<module>testing-modules/mockito-2</module>

0 commit comments

Comments
 (0)