jsf – How to generate compiled classes and keep the .java in maven?

Question:

Guys, whenever I do the maven install it compiles the classes and generates the xxx.class, so far so good. I would like to know if it is possible to generate the .class and also keep all the .java, in the application I am making I will need to show the page and the example code made to create the same logo I wanted to read and stream the .java and show it in screen.

My problem is that I only have the .class after maven install, could someone help me?

Answer:

Add the following resource to pom.xml :

    <resource>
        <directory>${basedir}/src/main/java</directory>
    </resource>

See more or less how it would look in the general structure of the file:

<project>
    ...
        <build>
            ...
                 <resources>
                    <resource>
                        <directory>${basedir}/src/main/java</directory>
                    </resource>
                </resources>
        </build>
</project>

If you want to know more about plugin resources : https://maven.apache.org/plugins/maven-resources-plugin/

And when you need to consult the general structure of the file to find out where a section or plugin can be configured: https://maven.apache.org/guides/introduction/introduction-to-the-pom.html

Scroll to Top