Skip to content

Commit ab4a389

Browse files
committed
[jgitflow-maven-plugin] merging 'release/cq-maven-plugin-1.1.2' into 'master'
2 parents a621430 + 370dc7f commit ab4a389

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

changes.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
2424
<body>
2525

26+
<release version="1.1.2" date="2019-11-20">
27+
<action type="update" dev="sseifert">
28+
Detect bundle projects using bnd-maven-plugin.
29+
</action>
30+
</release>
31+
2632
<release version="1.1.0" date="2019-08-20">
2733
<action type="add" dev="sseifert">
2834
Support installing content packages projects via cq:install.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<groupId>io.wcm.maven.plugins</groupId>
3333
<artifactId>cq-maven-plugin</artifactId>
34-
<version>1.1.1-SNAPSHOT</version>
34+
<version>1.1.2</version>
3535
<packaging>maven-plugin</packaging>
3636

3737
<name>CQ Maven Plugin</name>

src/main/java/io/wcm/maven/plugins/cq/InstallMojo.java

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)