Extra source Directory in Maven by sgrverma23 (#10991)

* Extra source Direcotry in Maven

* Update pom.xml

correcting Java version

Co-authored-by: Sakshi Verma <sakshikaju23@gmail.con>
This commit is contained in:
sgrverma23 2021-07-09 02:37:44 +05:30 committed by GitHub
parent a50be6d21c
commit 00df9206fe
4 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,41 @@
<?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.example</groupId>
<artifactId>maven-builder-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/newsrc/</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,12 @@
package com.baeldung.maven.plugin;
import com.baeldung.database.DataConnection;
public class MainApp {
public static void main(String args[]){
System.out.println(DataConnection.temp());
}
}

View File

@ -0,0 +1,7 @@
package com.baeldung.database;
public class DataConnection {
public static String temp(){
return "secondary source directory";
}
}

View File

@ -32,6 +32,7 @@
<module>version-overriding-plugins</module>
<module>versions-maven-plugin</module>
<module>maven-printing-plugins</module>
<module>maven-builder-plugin</module>
</modules>
</project>