Closed gspadotto closed 4 days ago
Hi @gspadotto,
We will analyze the bug and get back to you as soon as possible.
Best regards, Dedunu
Hi @DedunuKarunarathne did you have enough time for your analysis? Any news?
Hi @gspadotto,
Do you use Integration Studio or Archetype to generate your project? If it's through Integration Studio, we may need to apply a fix to the Studio's Java code. Otherwise, we can consider making adjustments directly to the archetype.
Thanks, Isuru
Hi @IsuruMaduranga, I use maven to build the artefacts within a CI/CD pipeline. Doesn't Integration Studio use the same archetypes/plugins "behind the curtains", so to say?
Hi @gspadotto,
Integration Studio does not use this archetype. It generates the pom file using JAVA. We can fix the issue in both Integration Studio and archetype. But I'm afraid it will take some time to release an update for the Integration Studio.
Thanks, Lahiru
Hi @gspadotto,
Until we release an updated version, you can bypass the described issue by temporarily disabling the following XML block in the CompositeExporter
pom.xml
:
<executions>
<execution>
<id>car</id>
<phase>package</phase>
<goals>
<goal>car</goal>
</goals>
</execution>
</executions>
To facilitate this modification in a CI/CD pipeline, I've prepared a sample shell script that automates the process. Please feel free to adjust it according to your needs:
#!/bin/bash
# Define the file path
FILE_PATH="pom.xml"
# Check if xmlstarlet is installed
if ! command -v xmlstarlet &> /dev/null
then
echo "xmlstarlet could not be found. Please install it to run this script."
exit 1
fi
# Check if the file exists
if [ ! -f "$FILE_PATH" ]; then
echo "File not found: $FILE_PATH"
exit 1
fi
# Backup the original file
cp $FILE_PATH "${FILE_PATH}.bak"
# Command to remove the specific executions block
xmlstarlet ed -N x="http://maven.apache.org/POM/4.0.0" \
-d "//x:project/x:build/x:plugins/x:plugin[x:artifactId='maven-car-plugin']/x:executions/x:execution[x:id='car']" \
$FILE_PATH > $FILE_PATH.mod
# Check for modifications and replace the original file if changes have been made
if cmp -s "$FILE_PATH" "$FILE_PATH.mod"
then
echo "No changes made."
rm "$FILE_PATH.mod"
else
mv "$FILE_PATH.mod" "$FILE_PATH"
echo "Executions block removed successfully."
fi
Thank you, Isuru
Hi @IsuruMaduranga thank you for the provided script!
Please refer to this issue in the PR that will fix it so that we can get notifications.
Description: The following lines in the CompositeExporter archetype cause the "package" phase to be executed twice: https://github.com/wso2-extensions/archetypes/blob/master/esb-project-archetype/src/main/resources/archetype-resources/__rootArtifactId__CompositeExporter/pom.xml#L77-L85
This is because the "car" goal from maven-car-plugin is already configured for the "package" phase in the default lifecycle: https://github.com/wso2/maven-tools/blob/v5.2.34/maven-car-plugin/src/main/resources/META-INF/plexus/components.xml#L35
Suggested Labels: bug
Suggested Assignees: pamodaaw
Affected Product Version: From 2.0.17: https://github.com/wso2-extensions/archetypes/commit/09c63836a242e730e2ea15b158aa6707d3e01a72#diff-99ecab20addd5e5942e6a7616a1883a3f5e7c504c9849f5cf7b4ec25d01f6556
Steps to reproduce:
Generate an Integration Project, move to the XXXXCompositeApplication folder, run:
mvn package
See that the "car" goal is executed twice, once with (default-car) and once with (car).
Alternatively, execute from the same folder the following command:
mvn buildplan:list
And see that the output is like the one below:
Related Issues: https://github.com/wso2/maven-tools/pull/118