I have a plugin which generates lots of java files (ie FileA.java, FileB.java) under target
folder. I'm using "exec-maven-plugin" to execute my plugin as follows
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-event-beans</id>
<phase>generate-sources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.my.project.generate.GenerateJavaFiles</mainClass>
<classpathScope>compile</classpathScope>
<arguments>
<argument>${basedir}/src/main/resources</argument>
<argument>${project.build.directory}/generated-sources/generated</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
I want to compile these java files created under ${project.build.directory}/generated-sources/generated
without adding them to source and package them in jar
With maven-compiler-plugin you can add your files to the build without adding them to src
folder.
Example from doc :
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<includes>
<include>...</include>
</includes>
</configuration>
</plugin>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.