@@ -104,13 +104,12 @@ public class InstallMojo extends AbstractMojo {
104104
105105 @ Override
106106 public void execute () throws MojoExecutionException , MojoFailureException {
107- String packaging = project .getPackaging ();
108107
109108 // detect goal to deploy current project based on packaging
110- if (StringUtils . equals ( packaging , "bundle" )) {
109+ if (isBundleProject ( )) {
111110 executeSlingPluginDirectly ();
112111 }
113- else if (StringUtils . equals ( packaging , "content-package" )) {
112+ else if (isContentPackageProject ( )) {
114113 getLog ().info ("Install content package to instance..." );
115114 executeWithMavenInvoker ("wcmio-content-package:install" );
116115 }
@@ -120,6 +119,29 @@ else if (StringUtils.equals(packaging, "content-package")) {
120119 }
121120 }
122121
122+ private boolean isBundleProject () {
123+ // check for "bundle" packaging as used by maven-bundle-plugin
124+ String packaging = project .getPackaging ();
125+ if (StringUtils .equals (packaging , "bundle" )) {
126+ return true ;
127+ }
128+
129+ // check for active bnd-maven-plugin in current project
130+ return project .getBuildPlugins ().stream ()
131+ .filter (this ::isBndMavenPlugin )
132+ .findFirst ().isPresent ();
133+ }
134+
135+ private boolean isBndMavenPlugin (Plugin plugin ) {
136+ return StringUtils .equals (plugin .getGroupId (), "biz.aQute.bnd" )
137+ && StringUtils .equals (plugin .getArtifactId (), "bnd-maven-plugin" );
138+ }
139+
140+ private boolean isContentPackageProject () {
141+ String packaging = project .getPackaging ();
142+ return StringUtils .equals (packaging , "content-package" );
143+ }
144+
123145 /**
124146 * Executes the sling-maven-plugin directly from the current project.
125147 * @throws MojoExecutionException
0 commit comments