Re: Updating Turbine archetype

Jeffery Painter <[email protected]> Tue, 23 Apr 2024 09:46:09 -0400
Newsgroups gmane.comp.jakarta.turbine.devel
Message-ID <[email protected]>
Quick update:

This configuration seems to work fine in eclipse without any explicit 
path defined:

...

<executable>${java.home}/bin/javac</executable>

I will add a property to define the surefire plugin, and use the above 
variable for now unless you can think of a better approach.

- Jeff

On 4/23/24 09:28, Jeffery Painter wrote:
> Hi Turbine devs,
>
> I have a couple down cycles and I have been looking at using the 
> latest Turbine 6.0 release. I was working to update the archetype to 
> generate a new project and I have run into a couple issues maybe you 
> can give some insight. I still use Eclipse as my IDE, so these may be 
> specific issues I am seeing there.
>
> Note, if I run mvn install in a new project from the CLI everything 
> seems OK, but getting Eclipse -> Maven install to work was throwing 
> some errors.
>
> Setup:
>
> Environment: Ubuntu 22.0, Eclipse 2024-03, maven 3.9.6, JDK 17.0.10 
> (LTS) from Oracle
>
> mvn --version
>
> Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
> Maven home: /usr/java/maven
> Java version: 17.0.10, vendor: Oracle Corporation, runtime: 
> /usr/java/jdk-17.0.10
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "6.5.0-27-generic", arch: "amd64", family: 
> "unix"
>
> Minor changes to the archetype in progress:
>
> +++ b/src/main/resources/archetype-resources/pom.xml
>
> <driverClassName>${turbine_database_driver}</driverClassName>
> -        <fulcrum.json>2.0.2-SNAPSHOT</fulcrum.json>
> - <fulcrum.intake>3.0.1-SNAPSHOT</fulcrum.intake>
> - <fulcrum.security>2.1.1-SNAPSHOT</fulcrum.security>
> -        <fulcrum.yaafi>2.0.1-SNAPSHOT</fulcrum.yaafi>
> +        <fulcrum.intake>3.0.0</fulcrum.intake>
> +        <fulcrum.parser>3.0.0</fulcrum.parser>
> +        <fulcrum.security>3.0.0</fulcrum.security>
> +        <fulcrum.yaafi>2.0.0</fulcrum.yaafi>
> +        <fulcrum.json>2.0.1</fulcrum.json>
>          <fulcrum.cache>2.0.0</fulcrum.cache>
> <fulcrum.testcontainer>2.0.0</fulcrum.testcontainer>
> -        <torque.version>5.2-SNAPSHOT</torque.version>
> -        <turbine.core>5.2-SNAPSHOT</turbine.core>
> +        <torque.version>5.1</torque.version>
> +        <turbine.core>6.0</turbine.core>
>          <skipTests>true</skipTests>
>          <docker>false</docker>
> <turbine_database_url>${turbine_database_url}</turbine_database_url>
>
> painter@merlin:~/apache/t/turbine-archetypes$ git diff 
> src/main/resources/META-INF/maven/archetype-metadata.xml
> diff --git a/src/main/resources/META-INF/maven/archetype-metadata.xml 
> b/src/main/resources/META-INF/maven/archetype-metadata.xml
> index 0158c60..9809418 100644
> --- a/src/main/resources/META-INF/maven/archetype-metadata.xml
> +++ b/src/main/resources/META-INF/maven/archetype-metadata.xml
> @@ -21,7 +21,7 @@
> xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" 
>
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 
> http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
> -  name="turbine-5.1-webapp">
> +  name="turbine-6.0-webapp">
>
>    <requiredProperties>
>      <requiredProperty key="turbine_app_name">
>
>
> I can install the archetype locally, build a sample app from CLI and 
> no issues. I try to import the new app into Eclipse, run maven install 
> and get 2 errors.
>
> The first is it complains is on the maven compiler plugin:
>
> [INFO] 
> ------------------------------------------------------------------------
>
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile(default-compile)on 
> project firstapp: Fatal error compiling: Error while 
> executing the external compiler. Error while executing process. Cannot 
> run program "${JAVA_HOME}/bin/javac" (in directory 
> "/home/painter/workspace/firstapp"): error=2, No such file or 
> directory -> [Help 1]
>
> [ERROR]
>
> I can overcome this error if I explicitly point to the JDK install by 
> making the following change to the pom.xml
>
> <plugin>
>
> <artifactId>maven-compiler-plugin</artifactId>
>
> <configuration>
>
> <source>${maven.compile.source}</source>
>
> <target>${maven.compile.target}</target>
>
> <encoding>${project.build.sourceEncoding}</encoding>
>
> <fork>true</fork>
>
> <executable>/usr/java/jdk/bin/javac</executable>
>
> </configuration>
>
> </plugin>
>
> The second error I get is then related to the surefire plugin:
>
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test(default-test)on 
> project firstapp: Given path to java executor does not 
> exist "/home/painter/workspace/firstapp/${JAVA_HOME}/bin/java".-> 
> [Help 1]
>
> I can overcome this error if I explicitly update the pom.xml to use 
> version 3.2.5
>
>
> <plugin>
>
> <groupId>org.apache.maven.plugins</groupId>
>
> <artifactId>maven-surefire-plugin</artifactId>
>
> <version>3.2.5</version>
>
> <configuration>
>
> <skipTests>${skipTests}</skipTests>
>
> <reuseForks>false</reuseForks>
>
> <forkCount>1</forkCount>
>
> </configuration>
>
> </plugin>
>
> Then everything will build fine. Also, I see if I have Tomcat 9.0.x 
> configured as my server it will launch from Eclipse OK, but it fails 
> with Tomcat 10 or 11. Is this expected?
>
> Any ideas on why it works from CLI mvn and not the Eclipse mvn 
> environment? I think specifiying the surefire version is an easy 
> change to make, but I am less certain on setting the default JDK in 
> the pom file (maybe we could pick this up in the archetype somehow?)
>
> Happy to hear your thoughts!
>
> -
>
> Jeff
>