Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
422 changes: 256 additions & 166 deletions .github/workflows/nightly.yml

Large diffs are not rendered by default.

19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Eclipse Starter for Jakarta EE

This is the official Eclipse Foundation Starter for Jakarta EE. It generates code to help get started with
Jakarta EE projects using Maven. It is possible to do so using Maven Archetypes or a web UI.
Jakarta EE projects using Maven or Gradle. It is possible to do so using Maven Archetypes or a web UI.

## Current Release

Expand Down Expand Up @@ -47,9 +47,24 @@ To run a specific version of the Archetype, including the locally installed deve
the `archetypeVersion` property.

```
mvn archetype:generate -DarchetypeGroupId="org.eclipse.starter" -DarchetypeArtifactId="jakarta-starter" -DarchetypeVersion="2.7.0-SNAPSHOT"
mvn archetype:generate -DarchetypeGroupId="org.eclipse.starter" -DarchetypeArtifactId="jakarta-starter" -DarchetypeVersion="2.7.1-SNAPSHOT"
```

### Generating Projects with Gradle Build System

By default, the archetype generates Maven-based projects. To generate a project with Gradle build system instead,
use the `-DbuildSystem=gradle` parameter:

```
mvn archetype:generate -DarchetypeGroupId="org.eclipse.starter" -DarchetypeArtifactId="jakarta-starter" -DbuildSystem=gradle
```

The archetype supports the following build systems:
- `maven` (default) - Generates a Maven project with pom.xml and Maven wrapper
- `gradle` - Generates a Gradle project with build.gradle and Gradle wrapper

All runtime options (GlassFish, WildFly, Open Liberty, Payara, TomEE) are supported with both build systems.

## Running the UI
In order to run the UI, please execute the following from this directory. You can also simply build the war
from Maven and deploy the war to either WildFly 28 or JBoss EAP 8. You can do this in an IDE if desired.
Expand Down
23 changes: 20 additions & 3 deletions archetype/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,29 @@ named `jakartaee-hello-world`. The README.md file under that directory will cont
run the sample.

If desired, you can easily use the Maven Archetype from a Maven capable IDE such
as [Eclipse](https://www.eclipse.org/ide). The generated starter code is simply Maven projects. You can easily
load, explore and run the code in a Maven capable IDE such as [Eclipse](https://www.eclipse.org/ide).
as [Eclipse](https://www.eclipse.org/ide). The generated starter code supports both Maven and Gradle build systems.
You can easily load, explore and run the code in any IDE that supports Maven or Gradle projects.

To run a specific version of the Archetype, including the locally installed development version,
specify the `archetypeVersion` property.

```
mvn archetype:generate -DarchetypeGroupId="org.eclipse.starter" -DarchetypeArtifactId="jakarta-starter" -DarchetypeVersion="2.7.0-SNAPSHOT"
mvn archetype:generate -DarchetypeGroupId="org.eclipse.starter" -DarchetypeArtifactId="jakarta-starter" -DarchetypeVersion="2.7.1-SNAPSHOT"
```

## Build System Options

The archetype supports generating projects with either Maven or Gradle build systems. By default, it generates
Maven projects. To generate a Gradle project, use the `-DbuildSystem=gradle` parameter:

```
mvn archetype:generate -DarchetypeGroupId="org.eclipse.starter" -DarchetypeArtifactId="jakarta-starter" -DbuildSystem=gradle
```

### Supported Parameters

- `buildSystem` - Build system to use (default: `maven`)
- `maven` - Generates project with pom.xml and Maven wrapper
- `gradle` - Generates project with build.gradle and Gradle wrapper

All other parameters (jakartaVersion, profile, runtime, etc.) work the same with both build systems.
2 changes: 1 addition & 1 deletion archetype/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.starter</groupId>
<artifactId>jakarta-starter</artifactId>
<version>2.7.0-SNAPSHOT</version>
<version>2.7.1-SNAPSHOT</version>
<packaging>maven-archetype</packaging>

<parent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ def profile = request.properties["profile"].trim().toLowerCase()
def javaVersion = request.properties["javaVersion"].trim()
def runtime = request.properties["runtime"].trim().toLowerCase()
def docker = request.properties["docker"].trim().toLowerCase()
def buildSystem = request.properties["buildSystem"]?.trim()?.toLowerCase() ?: "maven"

def outputDirectory = new File(request.getOutputDirectory(), request.getArtifactId())

validateInput(jakartaVersion, profile, javaVersion, runtime, docker, outputDirectory)
validateInput(jakartaVersion, profile, javaVersion, runtime, docker, buildSystem, outputDirectory)
generateRuntime(runtime, jakartaVersion, profile, javaVersion, docker, outputDirectory)
bindEEPackage(jakartaVersion, outputDirectory)
generateWebApp(profile, outputDirectory)
generateDocker(docker, runtime, outputDirectory)
chmod(outputDirectory.toPath().resolve("mvnw").toFile())
handleBuildSystem(buildSystem, outputDirectory)
printSummary()

private validateInput(jakartaVersion, profile, javaVersion, runtime, docker, File outputDirectory) {
private validateInput(jakartaVersion, profile, javaVersion, runtime, docker, buildSystem, File outputDirectory) {
if (!(jakartaVersion in ['8', '9', '9.1', '10', '11'])) {
FileUtils.forceDelete(outputDirectory)
throw new RuntimeException("Failed, valid Jakarta EE versions are 8, 9, 9.1, 10, and 11")
Expand All @@ -46,6 +47,11 @@ private validateInput(jakartaVersion, profile, javaVersion, runtime, docker, Fil
throw new RuntimeException("Failed, valid Docker options are yes and no")
}

if (!(buildSystem in ['maven', 'gradle'])) {
FileUtils.forceDelete(outputDirectory)
throw new RuntimeException("Failed, valid build systems are maven and gradle")
}

// As EE 11 progresses, this check should be removed.
if ((profile == 'full') && (jakartaVersion == '11')) {
FileUtils.forceDelete(outputDirectory)
Expand Down Expand Up @@ -239,6 +245,31 @@ private chmod(File mvnw) {
}
}

private handleBuildSystem(buildSystem, File outputDirectory) {
println "Configuring build system: $buildSystem"

if (buildSystem == "gradle") {
// Remove Maven files
FileUtils.forceDelete(new File(outputDirectory, "pom.xml"))
FileUtils.forceDelete(new File(outputDirectory, "mvnw"))
FileUtils.forceDelete(new File(outputDirectory, "mvnw.cmd"))
FileUtils.forceDelete(new File(outputDirectory, ".mvn"))

// Set executable permission on gradlew
chmod(outputDirectory.toPath().resolve("gradlew").toFile())
} else {
// Remove Gradle files
FileUtils.forceDelete(new File(outputDirectory, "build.gradle"))
FileUtils.forceDelete(new File(outputDirectory, "settings.gradle"))
FileUtils.forceDelete(new File(outputDirectory, "gradlew"))
FileUtils.forceDelete(new File(outputDirectory, "gradlew.cmd"))
FileUtils.forceDelete(new File(outputDirectory, "gradle"))

// Set executable permission on mvnw
chmod(outputDirectory.toPath().resolve("mvnw").toFile())
}
}

private printSummary() {
println "The README.md file in the " + request.properties["artifactId"] + " directory explains how to run the generated application"
}
21 changes: 21 additions & 0 deletions archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
<defaultValue>none</defaultValue>
<validationRegex>^(none|glassfish|open-liberty|payara|tomee|wildfly)$</validationRegex>
</requiredProperty>
<requiredProperty key="buildSystem">
<defaultValue>maven</defaultValue>
<validationRegex>^(maven|gradle)$</validationRegex>
</requiredProperty>
</requiredProperties>
<fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
Expand Down Expand Up @@ -76,5 +80,22 @@
<fileSet>
<directory>.mvn/wrapper</directory>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory></directory>
<includes>
<include>build.gradle</include>
<include>settings.gradle</include>
</includes>
</fileSet>
<fileSet filtered="false" encoding="UTF-8">
<directory></directory>
<includes>
<include>gradlew</include>
<include>gradlew.cmd</include>
</includes>
</fileSet>
<fileSet>
<directory>gradle/wrapper</directory>
</fileSet>
</fileSets>
</archetype-descriptor>
49 changes: 43 additions & 6 deletions archetype/src/main/resources/archetype-resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,29 @@ This is a sample application generated by the Eclipse Foundation Starter for Jak
#if (${runtime} != 'none')
You can run the application by executing the following command from the directory where this file resides.
Please ensure you have installed a [Java SE implementation](https://adoptium.net) appropriate for your
Jakarta EE version and runtime choice (this sample assumes Java SE ${javaVersion}). Note,
the [Maven Wrapper](https://maven.apache.org/wrapper/) is already included in the project, so a Maven install
Jakarta EE version and runtime choice (this sample assumes Java SE ${javaVersion}).
#if (${buildSystem} == 'gradle')
Note, the [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) is already included in the project, so a Gradle install
is not actually needed. You may first need to execute `chmod +x gradlew`.
#else
Note, the [Maven Wrapper](https://maven.apache.org/wrapper/) is already included in the project, so a Maven install
is not actually needed. You may first need to execute `chmod +x mvnw`.
#end

```
#if (${buildSystem} == 'gradle')
#if ((${runtime} == 'payara') && (${profile} != 'full'))
./gradlew clean build payaraStart
#elseif ((${runtime} == 'payara') || (${runtime} == 'glassfish'))
./gradlew clean build cargoRunLocal
#elseif (${runtime} == 'tomee')
./gradlew clean build tomeeRun
#elseif (${runtime} == 'wildfly')
./gradlew clean build wildflyRun
#elseif (${runtime} == 'open-liberty')
./gradlew clean build libertyRun
#end
#else
#if ((${runtime} == 'payara') && (${profile} != 'full'))
./mvnw clean package payara-micro:start
#elseif ((${runtime} == 'payara') || (${runtime} == 'glassfish'))
Expand All @@ -21,6 +39,7 @@ is not actually needed. You may first need to execute `chmod +x mvnw`.
#elseif (${runtime} == 'open-liberty')
./mvnw clean package liberty:run
#end
#end
```

#if ((${runtime} == 'payara') && (${profile} != 'full'))
Expand Down Expand Up @@ -48,12 +67,21 @@ You can also run the project via Docker. To build the Docker image, execute the
directory where this file resides. Please ensure you have installed
a [Java SE implementation](https://adoptium.net) appropriate for your Jakarta EE version/runtime
choice (this sample assumes Java SE ${javaVersion}) and
[Docker](https://docs.docker.com/get-docker/). Note,
the [Maven Wrapper](https://maven.apache.org/wrapper/) is already included in the project, so a Maven install
[Docker](https://docs.docker.com/get-docker/).
#if (${buildSystem} == 'gradle')
Note, the [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) is already included in the project, so a Gradle install
is not actually needed. You may first need to execute `chmod +x gradlew`.
#else
Note, the [Maven Wrapper](https://maven.apache.org/wrapper/) is already included in the project, so a Maven install
is not actually needed. You may first need to execute `chmod +x mvnw`.
#end

```
#if (${buildSystem} == 'gradle')
./gradlew clean build
#else
./mvnw clean package
#end
docker build -t ${artifactId}:v1 .
```

Expand Down Expand Up @@ -84,12 +112,21 @@ Once the runtime starts, you can access the REST end-point at [http://localhost:
#else
* You can build the application by executing the following command from the directory where this file resides.
Please ensure you have installed a [Java SE implementation](https://adoptium.net) appropriate for your
Jakarta EE version (this sample assumes Java SE ${javaVersion}). Note,
the [Maven Wrapper](https://maven.apache.org/wrapper/) is already included in the project, so a Maven install
Jakarta EE version (this sample assumes Java SE ${javaVersion}).
#if (${buildSystem} == 'gradle')
Note, the [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) is already included in the project, so a Gradle install
is not actually needed. You may first need to execute `chmod +x gradlew`.
#else
Note, the [Maven Wrapper](https://maven.apache.org/wrapper/) is already included in the project, so a Maven install
is not actually needed. You may first need to execute `chmod +x mvnw`.
#end

```
#if (${buildSystem} == 'gradle')
./gradlew clean build
#else
./mvnw clean package
#end
```

This will generate a file named `${artifactId}.war`. You should be able to run the application by deploying
Expand Down
Loading