Skip to content

Commit

Permalink
Feat: Adds support for mule-maven-plugin 4.x by checking for main art…
Browse files Browse the repository at this point in the history
…ifact before attached artifacts
  • Loading branch information
claytonflesher authored Feb 7, 2024
1 parent 677fd9b commit 23e8896
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ abstract class BaseMojo extends AbstractMojo {
* @return #{ParamsWrapper} - All properties from command-line (already formatted) plus the additionalProperties var
*/
protected ParamsWrapper getParamsWrapper() {
def artifact = mavenProject.attachedArtifacts.find { a ->
a.classifier == 'mule-application'
}?.file
def artifact = mavenProject.artifact

if (artifact == null || artifact.classifier != 'mule-application') {
logger.println "Didn't find mavenProject.artifact with appropriate classifier. Falling back to attached artifacts."
artifact = mavenProject.attachedArtifacts.find { a ->
a.classifier == 'mule-application'
}
}

def props = System.getProperties().findAll { String k, v ->
(k as String).startsWith('muleDeploy.')
}.collectEntries { k, v ->
Expand All @@ -38,8 +44,8 @@ abstract class BaseMojo extends AbstractMojo {
[withoutPrefix, v]
}
if (artifact) {
logger.println "Adding ${artifact} path as appArtifact in your DSL"
props['appArtifact'] = artifact.absolutePath
logger.println "Adding ${artifact.file} path as appArtifact in your DSL"
props['appArtifact'] = artifact.file.absolutePath
}
new ParamsWrapper(props + additionalProperties)
}
Expand Down

0 comments on commit 23e8896

Please sign in to comment.