Skip to content

Commit

Permalink
Feat: Adds support for mule-maven-plugin 4.x by pulling artifact file…
Browse files Browse the repository at this point in the history
…path from different location when applicable
  • Loading branch information
cflesher-c-reyes committed Feb 7, 2024
1 parent 677fd9b commit 918b804
Showing 1 changed file with 15 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,9 +44,13 @@ 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
}
// else if (primaryArtifact) {
// logger.println "Adding ${primaryArtifact} path as appArtifact in your DSL"
// props['appArtifact'] = primaryArtifact.absolutePath
// }
new ParamsWrapper(props + additionalProperties)
}

Expand Down

0 comments on commit 918b804

Please sign in to comment.