Clean up the first-run funkiness a little bit

This commit is contained in:
Brendan Robert 2024-07-02 01:33:10 -05:00
parent 137988ac43
commit d0a77855cd
2 changed files with 52 additions and 19 deletions

View File

@ -49,7 +49,7 @@ The Gluon documentation provides a compatibility matrix for each OS platform and
All other native dependencies are automatically downloaded as needed by Maven for the various LWJGL libraries.
### First time build note:
Because Jace provides an annotation processor for compilation, there is a chicken-and-egg problem when building the first time. In the pom.xml, comment out lines 35-42 dealing with annotation processors. Run `mvn install` and once that completes, un-comment those lines and compile a second time. After you compile the first time you don't have to do this step again as long as Maven is able to find a previously build version of Jace to provide this annotation processor.
Because Jace provides an annotation processor for compilation, there is a chicken-and-egg problem when building the first time. Currently, this means the first time you compile, run `mvn install` twice. You don't have to do this step again as long as Maven is able to find a previously build version of Jace to provide this annotation processor. I tried to set up the profiles in the pom.xml so that it disables the annotation processor the first time you compile to avoid any issues. If running in a CICD environment, keep in mind you will likely always need to run the "mvn install" step twice, but only if your goal is to build the entire application including the annotations (should not be needed for just running unit tests.)
## Support JACE:

69
pom.xml
View File

@ -26,23 +26,6 @@
<build>
<finalName>JaceApplication</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
<annotationProcessorPaths>
<path>
<groupId>org.badvision</groupId>
<artifactId>jace</artifactId>
<version>3.0</version>
</path>
</annotationProcessorPaths>
<annotationProcessors>jace.config.InvokableActionAnnotationProcessor</annotationProcessors>
</configuration>
<version>3.11.0</version>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
@ -279,6 +262,56 @@
</dependency>
</dependencies>
<profiles>
<profile>
<id>default</id>
<activation>
<file>
<exists>target/classes</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
<annotationProcessorPaths>
<path>
<groupId>org.badvision</groupId>
<artifactId>jace</artifactId>
<version>3.0</version>
</path>
</annotationProcessorPaths>
<annotationProcessors>jace.config.InvokableActionAnnotationProcessor</annotationProcessors>
</configuration>
<version>3.11.0</version>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>firstRun</id>
<activation>
<file>
<missing>target/classes</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
<version>3.11.0</version>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>lwjgl-natives-linux-amd64</id>
<activation>
@ -316,4 +349,4 @@
</properties>
</profile>
</profiles>
</project>
</project>