Thanks Tibor for sharing this information.
I look then forward to this next release of IBM BAMOE.
Original Message:
Sent: Fri March 15, 2024 03:59 AM
From: Tibor Zimányi
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Hi Bertrand,
as this was merged in main branch in the community, it should be part of the 9.1 release. However we don't have the release dates yet.
Best regards,
Tibor
------------------------------
Tibor Zimányi
Original Message:
Sent: Fri March 15, 2024 03:31 AM
From: GABRIELE CARDOSI
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Hi Bertrand,
sorry, I can not give an estimate for that.
The backport could be not so straightforward, since there is a different version of Quarkus behind, but I have to verify.
Best
Gabriele
------------------------------
GABRIELE CARDOSI
Original Message:
Sent: Thu March 14, 2024 10:29 AM
From: Bertrand Gillis
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Good to know indeed!
Do you have any idea when this change will be available in IBM BAMOE 9 ?
------------------------------
Bertrand Gillis
Original Message:
Sent: Thu March 14, 2024 10:22 AM
From: GABRIELE CARDOSI
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
For the moment being it has been implemented and tested specifically for Quarkus, since the issue was related to some Quarkus-specific inner implementation detail.
For the moment being, no test has been done with Springboot, AFAIK.
Best
Gabriele
------------------------------
GABRIELE CARDOSI
Original Message:
Sent: Thu March 14, 2024 10:07 AM
From: Bertrand Gillis
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
You're welcome ;-)
From my understanding, is it available for Quarkus only or also for Springboot ?
Kr,
Bertrand
------------------------------
Bertrand Gillis
Original Message:
Sent: Thu March 14, 2024 10:00 AM
From: GABRIELE CARDOSI
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Hi Bertrand,
the feature has been merged in main branch last week.
This is an example demontrating it.
Thanks again for your input!
Best regards
Gabriele
------------------------------
GABRIELE CARDOSI
Original Message:
Sent: Thu March 14, 2024 08:47 AM
From: Bertrand Gillis
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Hi Gabriele,
Good news to read that it will be possible in the next releases of Drools and Kogito to auto-detect DMNs also in /target/generated-resources.
Could you confirm that it will work in a Springboot project but also in a Quarkus project ?
Please share with me your modified reproducer project on any sharing service (eg. Box).
Kr,
Bertrand
------------------------------
Bertrand Gillis
Original Message:
Sent: Tue March 05, 2024 11:19 AM
From: GABRIELE CARDOSI
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Hi Bertrand,
finally I've been able to open the PRs (currently on draft).
https://github.com/apache/incubator-kie-drools/pull/5765
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3427
I've slightly modified your original reproducer, please let me know how I may send it, so that you may give it a try.
Best
Gabriele
------------------------------
GABRIELE CARDOSI
Original Message:
Sent: Tue January 23, 2024 08:56 AM
From: GABRIELE CARDOSI
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Hi Bertrand,
FYI: https://github.com/apache/incubator-kie-issues/issues/847
I'm sorry I can not provide any given deadline, but I'll try to do that ASAP
Best
Gabriele
------------------------------
GABRIELE CARDOSI
Original Message:
Sent: Tue January 23, 2024 03:55 AM
From: Bertrand Gillis
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Thanks Gabriele for your confirmation.
I will look then forward to your feedback about the fix for this issue.
Kr,
Bertrand
------------------------------
Bertrand Gillis
Original Message:
Sent: Mon January 22, 2024 09:46 AM
From: GABRIELE CARDOSI
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Ok Bertrand,
I'm sorry it does not work. I perfectly agree on not messing with src/main/resources during compile-time.
We definetely need to fix the code ASAP, I'll look to see if there is already a ticket for that or how we can manage it.
Best
Gabriele
------------------------------
GABRIELE CARDOSI
Original Message:
Sent: Mon January 22, 2024 09:35 AM
From: Bertrand Gillis
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Gabriele,
The configuration added to the pom.xml from my Quarkus project already led to the copy of the DMN files in "${project.build.directory}/classes" at build time and before the Kogito codegen is triggered.
So Having DMN files in "${project.build.directory}/classes" doesn't help unfortunately.
Kogito codegen lookups DMN files in "src/main/**" only.
I could unpack the DMN file directly into "\src\main\resources" folder instead of "${project.build.directory}/generated-resources/dmn" folder.
But, it is a very bad practice to mess up Maven project (re)sources with generated (re)sources.
Moreover, when I will try to release my Maven project ("com.mainsysgroup.dmn:mainsysgroup-dmn-allocation-score-quarkus"), Maven release plugin will detect uncommitted changes and will refuse to do the release.
So it will generate other Maven issues because Maven best practices are not followed.
Kr,
Bertrand
------------------------------
Bertrand Gillis
Original Message:
Sent: Mon January 22, 2024 09:12 AM
From: GABRIELE CARDOSI
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Thanks Bertrand,
what I see is that based on configuration the files are extracted to "generated-resources" of the main project:
did you try extracting them to ${project.build.directory}
/classes (IINW this is where the other dmn are copied) ?
I worked a bit with that code a lot of time ago, and while I absolutely agree it has to be improved, maybe that workaround could work (again, it could be just an attempt)
------------------------------
GABRIELE CARDOSI
Original Message:
Sent: Mon January 22, 2024 08:04 AM
From: Bertrand Gillis
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Thanks Gabriele for your input.
However, did you notice that I'm already using Maven dependency plugin to unpack DMN files from my Maven dependency ?
As you can see in the description of my issue, unpacking DMN files with Maven dependency plugin doesn't solve anything.
My issue seems to be a limitation of Kogito codegen... as explained in the first place.
Kind regards,
Bertrand
------------------------------
Bertrand Gillis
Original Message:
Sent: Mon January 22, 2024 03:55 AM
From: GABRIELE CARDOSI
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Hi Bertrand.
While Kogito does not provide a solution OOTB, the issue you mention is actually a common one for Maven projects. In that case, you could use the unpack:dependencies goal from the dependencies-plugin. Here's a similar discussion (you have to use correct setup for your use-case). I hope this help.
Best
Gabriele
------------------------------
GABRIELE CARDOSI
Original Message:
Sent: Fri January 19, 2024 11:11 AM
From: Bertrand Gillis
Subject: Quarkus + Kogito extension Maven project with generated DMN resources from another Maven dependency
Hi,
I would like to manage Quarkus files and DMN files in different Maven projects because both projects will be maintained by different teams and will have also different lifecycles:
- The DMN files will be authored and maintained by Business teams.
- The Quarkus files will be authored and maintained by IT teams.
Both Maven projects are available on my shared folder on
box.com.
DMN filesDMN files are authored by a business team and persisted in a git repository.
This Maven project ("
com.mainsysgroup.dmn:mainsysgroup-dmn-allocation-score-resources") produces a jar file containing a DMN file only:
- \pom.xml
- \src\main\resources\AllocationScore.dmn
It is not a Quarkus project.
This project can be built and install with "
mvn clean install".
Quarkus filesQuarkus files are authored by an IT team and persisted in another git repository.
This Maven project ("
com.mainsysgroup.dmn:mainsysgroup-dmn-allocation-score-quarkus") is the project that does not work as expected.
This project contains Quarkus + Kogito extension files only:
- \pom.xml
- \src\main\resources\application.properties
DMN files are not located in folder "
\src\main\resources" of this project; as illustrated in
https://github.com/kiegroup/kogito-examples.
DMN files are generated at build time from the Maven dependency "
com.mainsysgroup.dmn:mainsysgroup-dmn-allocation-score-resources:jar" and referenced as a resource directory in the current Maven project.
Excerpt from
pom.xml for this purpose...
<properties>
...
<dependency-plugin.version>3.6.1</dependency-plugin.version>
...
</properties>
...
<dependencies>
...
<!-- Maven dependency with DMM resources only -->
<dependency>
<groupId>com.mainsysgroup.dmn</groupId>
<artifactId>mainsysgroup-dmn-allocation-score-resources</artifactId>
<version>${project.version}</version>
</dependency>
...
</dependencies>
...
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<!-- DMN generated resources unpacked from com.mainsysgroup.dmn:mainsysgroup-dmn-allocation-score-resources -->
<resource>
<directory>${project.build.directory}/generated-resources/dmn</directory>
</resource>
</resources>
...
<!-- Unpacked DMN resources from com.mainsysgroup.dmn:mainsysgroup-dmn-allocation-score-resources -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${dependency-plugin.version}</version>
<executions>
<execution>
<id>unpack</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.mainsysgroup.dmn</groupId>
<artifactId>mainsysgroup-dmn-allocation-score-resources</artifactId>
<version>${project.version}</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/generated-resources/dmn</outputDirectory>
<includes>**/*.dmn</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
This project can be run with "
mvn clean process-resources quarkus:dev".
However the DMN file "
AllocationScore.dmn" generated at build time and declared as a Maven resource is not detected by Kogito codegen.
So the DMN file is never exposed as a REST API by the Quarkus service at runtime!
Looking at the Kogito codegen source code, I found that the Kogito Maven plugin lookups resources in directories following the pattern "
src/main/**" only.
https://github.com/kiegroup/kogito-runtimes/blob/main/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/utils/ApplicationGeneratorDiscovery.java protected AppPaths appPaths = AppPaths.fromProjectDir(new File(".").toPath(), Path.of(".", AppPaths.TARGET_DIR));
public static AppPaths fromProjectDir(Path projectDir, Path outputTarget) {
return new AppPaths(Collections.singleton(projectDir), Collections.emptyList(), false, BuildTool.findBuildTool(), "main", outputTarget);
}
Shouldn't the Kogito Maven plugin use Maven resources in a standard way instead of looking for them in an hardcoded path within Kogito codegen ?
Maybe could you also provide another solution to solve my use case (DMN and Quarkus files in separated git repositories and Maven artifacts) ?
Thanks for your help,
Bertrand
------------------------------
Bertrand Gillis
------------------------------