Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WFLY-17651] Add a new "Getting Started" archetype. #26

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
16a596b
[WFLY-17651] Add a new "Getting Started" archetype.
darranl Feb 19, 2023
68f1ba6
Update testing strategy
jmesnil Aug 9, 2023
0443f84
Merge pull request #1 from jmesnil/darranl-WFLY-17651
darranl Aug 9, 2023
6d645b5
Update packaging of the projects tests
jmesnil Aug 9, 2023
233eaed
Merge pull request #2 from jmesnil/darranl-WFLY-17651
darranl Aug 9, 2023
7bb3216
Update generated project README
jmesnil Aug 9, 2023
33d3918
Use default values to generate the project
jmesnil Aug 9, 2023
52b21b5
Fix name of the generated project in its pom.xml
jmesnil Aug 9, 2023
15488b7
Configure the name of the deployment
jmesnil Aug 10, 2023
ccaf22e
bump wildfly and wildfly-maven-plugin versions
jmesnil Aug 10, 2023
9705b01
Add a footer to the index.html page
jmesnil Aug 10, 2023
b87de3d
remove the intermediate prompt
jmesnil Aug 10, 2023
5731336
CDI + Unit tests
jmesnil Aug 10, 2023
c7165f3
remove unecessary dependencies
jmesnil Aug 10, 2023
3964dd2
fix endpoint code
jmesnil Aug 10, 2023
dd01068
Move the server / bom version to 29.0.0.Final
darranl Aug 11, 2023
90cfbe6
Move the WildFly plugin to 4.2.0.Final
darranl Aug 11, 2023
523df06
Update arquillian.xml
ehsavoie Aug 11, 2023
07537b2
Merge pull request #3 from jmesnil/darranl-WFLY-17651
darranl Aug 16, 2023
b2f687b
Merge pull request #4 from jmesnil/default_properties
darranl Aug 16, 2023
6308a50
Merge pull request #5 from ehsavoie/WFLY-17651-1
darranl Aug 16, 2023
624988d
Add back verify goal to maven-failsafe-plugin
jmesnil Aug 18, 2023
e7f4149
Test CDI Bean with Arquillian
jmesnil Aug 18, 2023
cc4c810
Merge pull request #7 from jmesnil/verify
darranl Aug 21, 2023
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
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<description>Aggregator for WildFly Maven archetypes</description>

<modules>
<module>wildfly-getting-started-archetype</module>
<module>wildfly-jakartaee-ear-archetype</module>
<module>wildfly-jakartaee-webapp-archetype</module>
<module>wildfly-subsystem-archetype</module>
Expand Down
65 changes: 65 additions & 0 deletions wildfly-getting-started-archetype/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
WildFly getting started archetype
-----------------------------

[[introduction]]
==== Introduction

This archetype creates a new WAR project which contains a simple Restful web
service and a HTML page to call the web service.

The generated project is configured to dynamically provision a WildFly server
and run the web application on the provisoned server so no manual installation
is required.

It is prepared for running Arquillian unit tests.
More details can be found in the file "src/main/resources/archetype-resources/README.txt", which is end-user doc and added to the resulting project.

[[newwildflyversion]]
==== New WildFly version
To update this archetype to a new WildFly version:
In file "pom.xml":

* update the version
* update to latest "org.jboss:jboss-parent" version found at https://repo.maven.apache.org/maven2/org/jboss/jboss-parent/

In file "src/main/resources/archetype-resources/pom.xml":

* update the version property named "version.jboss.bom"
* check whether dependencies have changed.
* check the plugin versions and update if necessary:
** wildfly-maven-plugin: https://repo.maven.apache.org/maven2/org/wildfly/plugins/wildfly-maven-plugin/
** maven-compiler-plugin: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/
** maven-surefire-plugin: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/
** maven-failsafe-plugin: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-failsafe-plugin/
** maven-war-plugin: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-war-plugin/

Also test whether the Arquillian unit test "SampleIT" still works, see below.

[[build]]
==== Build
To build the archetype, you need at least Java 11. Run this command:
[source,options="nowrap"]
----
$ mvn clean install
----
It will be installed to your local maven repository at "%USERHOME%/.m2/repository/org/wildfly/archetype/wildfly-getting-started-archetype/", and an entry will be added to "%USERHOME%/.m2/repository/archetype-catalog.xml".

[[createproject]]
==== Create project from archetype
To create a new project from this archetype, use this maven command (replace dummy values for "groupId", "artifactId" and "version" with correct values):
----
$ mvn archetype:generate -DgroupId=my.project.org -DartifactId=sampleproject -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.wildfly.archetype -DarchetypeArtifactId=wildfly-getting-started-archetype -DarchetypeVersion=28.0.0.Final-SNAPSHOT
----

[[testing]]
==== Test the archetype
After having built the archetype, check whether both profiles "arq-remote" and "arq-managed" work. This is done by using scripts found in the directory "testing".

* Profile "arq-managed": set variable JBOSS_HOME, then execute "runtest_managed.bat/.sh <archetypeVersion>" (replace "<archetypeVersion>" with the current archetype version)
* Profile "arq-remote": start WildFly server, then execute "runtest_remote.bat/.sh <archetypeVersion>" (replace "<archetypeVersion>" with the current archetype version)

Both files create a project from the archetype (in "testing/arq-managed" or "testing/arq-remote"), copy an Arquillian unit test class and an EJB in this project, then build and deploy it to WildFly and execute
the test using the Arquillian profile "arq-managed" or "arq-remote").

After the test is executed, check the server log for error outputs. In case of success, the outputs "Test is invoked..." and "doTest is invoked..." will be printed in the server console.

60 changes: 60 additions & 0 deletions wildfly-getting-started-archetype/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed under the Apache License, Version 2.0 (the "License"); you
may not use this file except in compliance with the License. You may obtain
a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jboss</groupId>
<artifactId>jboss-parent</artifactId>
<version>39</version>
<relativePath />
</parent>

<groupId>org.wildfly.archetype</groupId>
<artifactId>wildfly-getting-started-archetype</artifactId>
<version>28.0.0.Final-SNAPSHOT</version>
<packaging>maven-archetype</packaging>

<name>WildFly Archetypes: Getting Started</name>
<description>An archetype that generates a starter Jakarta EE project for the WildFly application server.</description>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>

<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
</extension>
</extensions>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-archetype-plugin</artifactId>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor xsi:schemaLocation="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0 http://maven.apache.org/xsd/archetype-descriptor-1.1.0.xsd" name="login-form"
xmlns="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<requiredProperties>
<requiredProperty key="defaultClassPrefix">
<defaultValue>GettingStarted</defaultValue>
</requiredProperty>
<requiredProperty key="groupId">
<defaultValue>org.wildfly.examples</defaultValue>
</requiredProperty>
<requiredProperty key="artifactId">
<defaultValue>getting-started</defaultValue>
</requiredProperty>
<requiredProperty key="package">
<defaultValue>org.wildfly.examples</defaultValue>
</requiredProperty>
<requiredProperty key="version">
<defaultValue>1.0.0-SNAPSHOT</defaultValue>
</requiredProperty>
</requiredProperties>
<fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.html</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>src/main/webapp</directory>
<includes>
<include>**/*.css</include>
<include>**/*.ico</include>
<include>**/*.gif</include>
<include>**/*.png</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/test/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/test/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>.settings</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>.settings</directory>
<includes>
<include>**/*.container</include>
<include>**/*.component</include>
<include>**/*.name</include>
<include>**/*.jsdtscope</include>
<include>**/*.prefs</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory></directory>
<includes>
<include>README.adoc</include>
<include>.project</include>
<include>.classpath</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory></directory>
<includes>
<include>.gitignore</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )

= ${artifactId}

The `${artifactId}` project is a simple Jakarta EE application with a HTTP endpoint that is running in
https://wildfly.org[WildFly].

The `src/main` folder contains a simple 'Hello world' style Jakarta EE application using JAX-RS.

== Building the application

To run the application, you use Maven:

[source,shell]
----
mvn clean package
----

Maven will compile the application, provision a WildFly server
The WildFly server is created in `target/server` with the application deployed in it.

== Running the application

To run the application, run the commands:

[source,shell]
----
cd target/server
./bin/standalone.sh
----

Once WildFly is running, the application can be accessed at http://localhost:8080/

== Testing the application

To run integration tests to verify the application, you use Maven:

[source,shell]
----
mvn clean package verify
----

Tests in `src/test` are run against the server in `target/server`.

== Resources

* https://wildfly.org[WildFly]
* https://docs.wildfly.org[WildFly Documentation]
Loading