I have a folder of java sources which I wish to exclude from the compilation.
My folder is under qa/apitests/src/main/java/api/test/omi
.
I added the following entry in the pom.xml
under qa/bamtests
but it didn't help. Is there an entry in addition I need to make?
<build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> <include>**/*.xsd</include> <include>**/*.csv</include> </includes> <excludes> <exclude>src/main/java/api/test/omi</exclude> </excludes> </resource> </build>
The package goal will compile your Java code, run any tests, and finish by packaging the code up in a JAR file within the target directory. The name of the JAR file will be based on the project's <artifactId> and <version> . For example, given the minimal pom.
Maven is a Java tool, so you must have Java installed in order to proceed. Depending upon your network setup, you may require extra configuration. Check out the Guide to Configuring Maven if necessary.
The Compiler Plugin is used to compile the sources of your project. Since 3.0, the default compiler is javax. tools. JavaCompiler (if you are using java 1.6) and is used to compile Java sources.
Use the Maven Compiler Plugin.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <excludes> <exclude>**/api/test/omi/*.java</exclude> </excludes> </configuration> </plugin>
Adding an exclude as the other answers suggested worked for me, except the path shouldn't include "src/main/java":
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <excludes> <exclude>com/filosync/store/StoreMain.java</exclude> </excludes> </configuration> </plugin> </plugins> </build>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With