Merge pull request #3888 from nguyennamthai/BAEL-1642

Core Maven Plugins
This commit is contained in:
Tom Hombergs 2018-03-26 21:46:15 +02:00 committed by GitHub
commit 8da5252b51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 174 additions and 0 deletions

1
maven/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/output-resources

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1 @@
Welcome to ${resources.name}!

View File

@ -0,0 +1,9 @@
<verifications xmlns="http://maven.apache.org/verifications/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/verifications/1.0.0 http://maven.apache.org/xsd/verifications-1.0.0.xsd">
<files>
<file>
<location>input-resources/baeldung.txt</location>
<contains>Welcome</contains>
</file>
</files>
</verifications>

116
maven/pom.xml Normal file
View File

@ -0,0 +1,116 @@
<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>com.baeldung</groupId>
<artifactId>maven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<artifactId>parent-modules</artifactId>
<groupId>com.baeldung</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<properties>
<maven.resources.version>3.0.2</maven.resources.version>
<maven.compiler.version>3.7.0</maven.compiler.version>
<maven.surefire.version>2.21.0</maven.surefire.version>
<maven.failsafe.version>2.21.0</maven.failsafe.version>
<maven.verifier.version>1.1</maven.verifier.version>
<maven.clean.version>3.0.0</maven.clean.version>
<resources.name>Baeldung</resources.name>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven.resources.version}</version>
<configuration>
<outputDirectory>output-resources</outputDirectory>
<resources>
<resource>
<directory>input-resources</directory>
<excludes>
<exclude>*.png</exclude>
</excludes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-Xlint:unchecked</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<excludes>
<exclude>DataTest.java</exclude>
</excludes>
<includes>
<include>DataCheck.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven.failsafe.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<!-- configuration similar to surefire -->
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-verifier-plugin</artifactId>
<version>${maven.verifier.version}</version>
<configuration>
<verificationFile>input-resources/verifications.xml</verificationFile>
</configuration>
<executions>
<execution>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven.clean.version}</version>
<configuration>
<filesets>
<fileset>
<directory>output-resources</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,16 @@
package com.baeldung.maven.plugins;
import java.util.ArrayList;
import java.util.List;
public class Data {
List<String> textList = new ArrayList();
public void addText(String text) {
textList.add(text);
}
public List getTextList() {
return this.textList;
}
}

View File

@ -0,0 +1,15 @@
package com.baeldung.maven.plugins;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import com.baeldung.maven.plugins.Data;
public class DataCheck {
@Test
public void whenDataObjectIsCreated_thenItIsNotNull() {
Data data = new Data();
assertNotNull(data);
}
}

View File

@ -0,0 +1,15 @@
package com.baeldung.maven.plugins;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import com.baeldung.maven.plugins.Data;
public class DataTest {
@Test
public void whenDataObjectIsNotCreated_thenItIsNull() {
Data data = null;
assertNull(data);
}
}

View File

@ -122,6 +122,7 @@
<!-- <module>kotlin</module> -->
<module>mapstruct</module>
<!-- <module>metrics</module> -->
<module>maven</module>
<module>mesos-marathon</module>
<module>testing-modules/mockito</module>
<module>testing-modules/mockito-2</module>