Search code examples
javamavenclasscompilationpom.xml

How to use class file instead of java file when compiling with maven


We received an updated .class file but not the .java file for a project. How can I ensure this new class file is used, and placed in the right directory, in the compiling of our maven pom without affecting the project?


Solution

  • Not sure if this is the best method, but i was able to accomplish using this class file as a replacement for .java and no .jar file being provided by adding this resource argument to the maven pom file.

    <resource>
        <directory>${project.basedir}/src/main/java/com/action/helper</directory>
        <targetPath>${project.build.directory}/classes/com/action/helper</targetPath>
        <excludes>
            <exclude>**/*.java</exclude>
        </excludes>
    </resource>