Skip to content

Commit

Permalink
Merge pull request OpenLiberty#1847 from jjiwooLim/featuresbom
Browse files Browse the repository at this point in the history
fix features-bom issue
  • Loading branch information
cherylking authored Dec 2, 2024
2 parents 6198492 + d6c2fa2 commit 3ca66be
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,6 @@
<goal>copy-resources</goal>
</goals>

<configuration>
<outputDirectory>${user.home}/.m2/repository/test/user/test/osgi/hello-bom/1.0</outputDirectory>
<resources>
<resource>
<directory>src/test/resources</directory>
<includes>
<include>hello-bom-1.0.pom</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resource-two</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>

<configuration>
<outputDirectory>${user.home}/.m2/repository/test/user/test/osgi/hello-esa-plugin/1.0</outputDirectory>
<resources>
Expand All @@ -61,26 +42,26 @@
</configuration>
</execution>
<execution>
<id>copy-resource-three</id>
<id>copy-resource-two</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>

<configuration>
<outputDirectory>${user.home}/.m2/repository/test/user/test/osgi/SimpleActivator-bom/1.0</outputDirectory>
<outputDirectory>${user.home}/.m2/repository/test/user/test/osgi/features-bom/1.0</outputDirectory>
<resources>
<resource>
<directory>src/test/resources</directory>
<includes>
<include>SimpleActivator-bom-1.0.pom</include>
<include>features-bom-1.0.pom</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resource-four</id>
<id>copy-resource-three</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy-resources</goal>
Expand Down Expand Up @@ -156,18 +137,12 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>${bom.group.id}</groupId>
<artifactId>hello-bom</artifactId>
<version>1.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>test.user.test.osgi</groupId>
<artifactId>SimpleActivator-bom</artifactId>
<version>1.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>test.user.test.osgi</groupId>
<artifactId>features-bom</artifactId>
<version>1.0</version>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>test.user.test.osgi</groupId>
<artifactId>SimpleActivator-bom</artifactId>
<artifactId>features-bom</artifactId>
<version>1.0</version>
<packaging>pom</packaging>

Expand All @@ -15,5 +15,16 @@
<type>esa</type>
</dependency>
</dependencies>

<dependencies>
<dependency>
<groupId>test.user.test.osgi</groupId>
<!--artifactId>hello-esa-plugin</artifactId-->
<artifactId>${esa.artifact.id}</artifactId>
<version>1.0</version>
<type>esa</type>
<scope>runtime</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>

This file was deleted.

6 changes: 3 additions & 3 deletions liberty-maven-plugin/src/it/verify-user-feature-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
</goals>

<configuration>
<outputDirectory>${user.home}/.m2/repository/test/user/test/osgi/SimpleActivator-bom/1.0</outputDirectory>
<outputDirectory>${user.home}/.m2/repository/test/user/test/osgi/features-bom/1.0</outputDirectory>
<resources>
<resource>
<directory>src/test/resources</directory>
<includes>
<include>SimpleActivator-bom-1.0.pom</include>
<include>features-bom-1.0.pom</include>
</includes>
</resource>
</resources>
Expand Down Expand Up @@ -159,7 +159,7 @@
<dependencies>
<dependency>
<groupId>test.user.test.osgi</groupId>
<artifactId>SimpleActivator-bom</artifactId>
<artifactId>features-bom</artifactId>
<version>1.0</version>
<type>pom</type>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>test.user.test.osgi</groupId>
<artifactId>SimpleActivator-bom</artifactId>
<artifactId>features-bom</artifactId>
<version>1.0</version>
<packaging>pom</packaging>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,16 @@ protected List<String> getAdditionalJsonList() {
List<String> result = new ArrayList<String>();
org.apache.maven.model.DependencyManagement dependencyManagement = project.getDependencyManagement();
if(dependencyManagement == null) {
getLog().debug("Feature-bom is not provided by the user");
getLog().debug("Features-bom is not provided by the user");
return null;
}
List<org.apache.maven.model.Dependency> dependencyManagementArtifacts = dependencyManagement.getDependencies();
for (org.apache.maven.model.Dependency dependencyArtifact: dependencyManagementArtifacts){
if (("pom").equals(dependencyArtifact.getType())) {
if (("pom").equals(dependencyArtifact.getType()) && ("features-bom").equals(dependencyArtifact.getArtifactId())) {
String coordinate = String.format("%s:%s:%s",
dependencyArtifact.getGroupId(), FEATURES_JSON_ARTIFACT_ID, dependencyArtifact.getVersion());
result.add(coordinate);
getLog().debug("Features-bom is provided by the user");
getLog().info("Additional user feature json coordinate: " + coordinate);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected List<String> getDependencyBOMs() {
if (dependencyManagement != null) {
List<org.apache.maven.model.Dependency> dependencyManagementArtifacts = dependencyManagement.getDependencies();
for (org.apache.maven.model.Dependency dependencyArtifact: dependencyManagementArtifacts){
if (("pom").equals(dependencyArtifact.getType())) {
if (("pom").equals(dependencyArtifact.getType()) && ("features-bom").equals(dependencyArtifact.getArtifactId()) ) {
String coordinate = String.format("%s:%s:%s",
dependencyArtifact.getGroupId(), dependencyArtifact.getArtifactId(), dependencyArtifact.getVersion());
result.add(coordinate);
Expand Down

0 comments on commit 3ca66be

Please sign in to comment.