Skip to content

[#185] Update archetype for WildFly subsystem#194

Open
jmesnil wants to merge 1 commit intowildfly:mainfrom
jmesnil:update_wildfly-subsystem-archetype
Open

[#185] Update archetype for WildFly subsystem#194
jmesnil wants to merge 1 commit intowildfly:mainfrom
jmesnil:update_wildfly-subsystem-archetype

Conversation

@jmesnil
Copy link
Copy Markdown
Member

@jmesnil jmesnil commented Nov 19, 2025

Rewrite it from scratch based on the latest WildFly API. This creates a multimodule Maven project:

  • xxx-extension
    • Provides the code for the WildFly extension and its subsystem. It build a simple extension to track the number of deployments (so that it provides examples for resources, runtime attributes, DUP)
  • xxx-feature pack
    • Provides a feature pack to provision the extension (using layers)
  • xxx-testsuite
    • Provide an integration testsuite to test a WildFly installation with the provided layer

This fixes [#185]

@jmesnil jmesnil force-pushed the update_wildfly-subsystem-archetype branch from 49be316 to f61a2bf Compare November 19, 2025 13:23
@jmesnil jmesnil changed the title Update archetype for WildFly subsystem [#185] Update archetype for WildFly subsystem Nov 19, 2025
@jmesnil
Copy link
Copy Markdown
Member Author

jmesnil commented Nov 20, 2025

It's annoying to review the code from the archetype so generating a project and looking at the end result might help.

Once you have pulled the PR and do a mvn install, you can generate a project with:

 mvn archetype:generate \
  -DarchetypeGroupId=org.wildfly.archetype \
  -DarchetypeArtifactId=wildfly-subsystem \
  -DarchetypeVersion=38.0.1.Final-SNAPSHOT \
  -DgroupId=org.foo \
  -DartifactId=bar

and then

cd bar
mvn install

@jmesnil jmesnil requested a review from pferraro November 20, 2025 07:28
@jmesnil jmesnil force-pushed the update_wildfly-subsystem-archetype branch from f61a2bf to ac17540 Compare November 20, 2025 09:01
@jmesnil
Copy link
Copy Markdown
Member Author

jmesnil commented Nov 20, 2025

@jmesnil jmesnil force-pushed the update_wildfly-subsystem-archetype branch from ac17540 to c17888a Compare November 20, 2025 09:43
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modules/system/layers/base is for WildFly core modules, that is perhaps just fine. But you could add your module at the root of the modules directory.
In such a case, modules.all would be not available, you would use the module name as default package.

Copy link
Copy Markdown
Member Author

@jmesnil jmesnil Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when I use instead

    <default-packages>
        <package name="${package}"/>
    </default-packages>

and move the module at the root of modules, I get the error:

[ERROR] Failed to execute goal org.wildfly.galleon-plugins:wildfly-galleon-maven-plugin:8.0.2.Final:build-feature-pack (bar-build-feature-pack) on project bar-feature-pack: Failed
to write to /Users/jmesnil/Developer/wildfly-archetypes/wildfly-subsystem-archetype/target/test-classes/projects/basic/project/bar/bar-feature-pack/target/layout/org.wildfly.foo/ba
r-feature-pack/1.0-SNAPSHOT/feature-pack.xml: Package org.wildfly.foo.bar is not found in org.wildfly.foo:bar-feature-pack:1.0-SNAPSHOT -> [Help 1]

Do I have to explicitly create a package to bundle the module?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, build-feature-pack goal expects the modules to be in system/layers/base or addOns, addOns is perhaps a better place than system?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I want to provision the modules in the add-ons directory, I need to specify the layers.conf right?

@jmesnil jmesnil force-pushed the update_wildfly-subsystem-archetype branch from c17888a to e1e2b41 Compare November 20, 2025 12:41
@WolfgangHG
Copy link
Copy Markdown
Contributor

The old archetype was tested by a script that created a project from the archetype and "installed" it to a WildFly instance. This is not part of the new archetype? So, currently it is only verified that it builds, but not that it actually works?

Also, the end user "Readme.md" does not seem to contain the steps necessary to install the subsystem and/or the feature pack.

@jmesnil
Copy link
Copy Markdown
Member Author

jmesnil commented Nov 21, 2025

The old archetype was tested by a script that created a project from the archetype and "installed" it to a WildFly instance. This is not part of the new archetype? So, currently it is only verified that it builds, but not that it actually works?

The new archetype is definitely tested when Maven runs. It installs the archetype, generate a project and run mvn install to make sure it is correct.

@jmesnil
Copy link
Copy Markdown
Member Author

jmesnil commented Nov 21, 2025

Also, the end user "Readme.md" does not seem to contain the steps necessary to install the subsystem and/or the feature pack.

It does at https://github.com/wildfly/wildfly-archetypes/pull/194/files#diff-427e35e9a33e13581fbc19abcec60bc3b45006ec5df9ab38e866d0b160e91b0bR35.

It relies on provisioning with the wildfly maven plugin.
I will also add instructions to install it with Galleon on an existing WildFly installation (so that it would explain how to do it to install it in a WildFly unzipped archive for example)

✅ Done at https://github.com/wildfly/wildfly-archetypes/pull/194/files#diff-427e35e9a33e13581fbc19abcec60bc3b45006ec5df9ab38e866d0b160e91b0bR65

@jmesnil jmesnil force-pushed the update_wildfly-subsystem-archetype branch from e1e2b41 to 688be3b Compare November 21, 2025 08:10
@WolfgangHG
Copy link
Copy Markdown
Contributor

@jmesnil I pulled the pull request and made a run. You are right, the subsystem is deployed to the server. Sorry, my previous comment came from someone not having any knowledge of subsystems or featurepacks ;-).

During build, I found those warnings when the test project is created:

[INFO] --- archetype:3.4.1:integration-test (default-integration-test) @ wildfly-subsystem ---
[INFO] Processing Archetype IT project: basic
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: wildfly-subsystem:39.0.0.Final-SNAPSHOT
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: org.wildfly.foo
[INFO] Parameter: artifactId, Value: bar
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: org.wildfly.foo.bar
[INFO] Parameter: packageInPathFormat, Value: org/wildfly/foo/bar
[INFO] Parameter: package, Value: org.wildfly.foo.bar
[INFO] Parameter: groupId, Value: org.wildfly.foo
[INFO] Parameter: artifactId, Value: bar
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[WARNING] Don't override file C:\Temp\github\test\wildfly-archetypes\wildfly-subsystem-archetype\target\test-classes\projects\basic\project\bar\pom.xml
[INFO] Project created from Archetype in dir: C:\Temp\github\test\wildfly-archetypes\wildfly-subsystem-archetype\target\test-classes\projects\basic\project\bar
[INFO] Invoking post-archetype-generation goals: install
[INFO] [INFO] Error stacktraces are turned on.
[INFO] [INFO] Scanning for projects...
[INFO] [WARNING]
[INFO] [WARNING] Some problems were encountered while building the effective model for org.wildfly.foo:bar-feature-pack:pom:1.0-SNAPSHOT
[INFO] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. @ line 38, column 21
[INFO] [WARNING]
[INFO] [WARNING] Some problems were encountered while building the effective model for org.wildfly.foo:bar-testsuite:jar:1.0-SNAPSHOT
[INFO] [WARNING] 'build.plugins.plugin.version' for org.wildfly.plugins:wildfly-maven-plugin is missing. @ line 34, column 21
[INFO] [WARNING]
[INFO] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[INFO] [WARNING]
[INFO] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[INFO] [WARNING]

And later, this was printed:

[INFO] 20:07:53,511 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "bar-test.war" (runtime-name: "bar-test.war")
[INFO] 20:07:55,512 WARN  [org.jboss.weld.deployer] (MSC service thread 1-6) WFLYWELD0013: Deployment bar-test.war contains Jakarta Contexts and Dependency Injection annotations but no bean archive was found (no beans.xml or class with bean defining annotations was present).

I don't see a "bar-test.war" being created. Where does it come from?

Rewrite it from scratch based on the latest WildFly API.
This creates a multimodule Maven project:
* xxx-extension
  * Provides the code for the WildFly extension and its subsystem. It build a simple extension
to track the number of deployments (so that it provides examples for resources, runtime attributes, DUP)
* xxx-feature pack
  * Provides a feature pack to provision the extension (using layers)
* xxx-testsuite
  * Provide an integration testsuite to test a WildFly installation with the provided layer

This fixes wildfly#185

Signed-off-by: Jeff Mesnil <jmesnil@redhat.com>
@jmesnil jmesnil force-pushed the update_wildfly-subsystem-archetype branch from 688be3b to 70decd2 Compare November 24, 2025 07:46
@jmesnil
Copy link
Copy Markdown
Member Author

jmesnil commented Nov 24, 2025

[INFO] [WARNING] Some problems were encountered while building the effective model for org.wildfly.foo:bar-feature-pack:pom:1.0-SNAPSHOT
[INFO] [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. @ line 38, column 21
[INFO] [WARNING]
[INFO] [WARNING] Some problems were encountered while building the effective model for org.wildfly.foo:bar-testsuite:jar:1.0-SNAPSHOT
[INFO] [WARNING] 'build.plugins.plugin.version' for org.wildfly.plugins:wildfly-maven-plugin is missing. @ line 34, column 21

Good catch, I updated the poms to explicitly add versions to these plugins.
thanks!

@jmesnil
Copy link
Copy Markdown
Member Author

jmesnil commented Nov 24, 2025

I don't see a "bar-test.war" being created. Where does it come from?

It it an deployment added in the tests by Arquillian at https://github.com/wildfly/wildfly-archetypes/pull/194/files#diff-b8bcf8551e2f89a2afa8babfa63955824306f7f44eeca1b284dcf62339acec68R42

@WolfgangHG
Copy link
Copy Markdown
Contributor

Thanks, I did not see this test case.

Did you see this warning in my previous comment?

[WARNING] Don't override file C:\Temp\github\test\wildfly-archetypes\wildfly-subsystem-archetype\target\test-classes\projects\basic\project\bar\pom.xml

I think the "pom.xml" line in "archetype-metadata.xml" is uncessary.

@WolfgangHG
Copy link
Copy Markdown
Contributor

@jmesnil Did you see my previous comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants