JAVA-49: new module for multiple source directories with Maven

This commit is contained in:
sampadawagde 2020-06-28 16:19:51 +05:30
parent 3d2c0cddc0
commit e84dd497a5
6 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,2 @@
/output-resources
/.idea/

View File

@ -0,0 +1,7 @@
## Apache Maven - Multiple Source Directories
This module contains articles about how to use multiple source directories with Maven.
### Relevant Articles
- [Maven Project with Multiple Source Directories](https://www.baeldung.com/maven-project-multiple-src-directories)

View File

@ -0,0 +1,92 @@
<?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>
<artifactId>maven-multi-source</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>maven-multi-source</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgs>
<arg>-Xlint:unchecked</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${maven.build.helper.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/another-src</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>surefire</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/*IntegrationTest</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>
<maven.resources.version>3.0.2</maven.resources.version>
<maven.compiler.version>3.8.0</maven.compiler.version>
<maven.surefire.version>2.22.0</maven.surefire.version>
<maven.failsafe.version>2.22.0</maven.failsafe.version>
<maven.verifier.version>1.1</maven.verifier.version>
<maven.clean.version>3.0.0</maven.clean.version>
<maven.build.helper.version>3.0.0</maven.build.helper.version>
<jetty.version>9.4.11.v20180605</jetty.version>
<jersey.version>2.27</jersey.version>
</properties>
</project>

View File

@ -0,0 +1,10 @@
package com.baeldung.maven.plugins;
public class Foo {
public static String foo() {
return "foo";
}
}

View File

@ -0,0 +1,9 @@
package com.baeldung.maven.plugins;
public class MultipleSrcFolders {
public static void callFoo() {
Foo.foo();
}
}

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>