Skip to content

Commit

Permalink
All Its fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamas committed Oct 8, 2024
1 parent 741c711 commit cd41823
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ bomArtifactId - The artifactId to set in the generated BOM
bomVersion - The version to set in the generated BOM
bomName - The name to set in the generated BOM
bomDescription - The description to set in the generated BOM
exclusions - A list of exclusions to set in the genertated BOM
dependencyExclusions - A list of dependencies which should not be included in the genertated BOM
exclusions - A list of exclusions to set in the generated BOM
dependencyExclusions - A list of dependencies which should not be included in the generated BOM

Each exclusion should contain four parameters:
- dependencyGroupId
Expand Down
10 changes: 10 additions & 0 deletions bom-builder3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-xml</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jboss.maven.plugins.bombuilder;

import static org.codehaus.plexus.util.StringUtils.defaultString;
import static org.codehaus.plexus.util.StringUtils.trim;

import java.io.File;
Expand All @@ -9,6 +8,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Dependency;
Expand Down Expand Up @@ -219,7 +219,7 @@ private void addDependencyManagement(Model pomModel) {
}

boolean isExcludedDependency(Artifact artifact) {
if (dependencyExclusions == null || dependencyExclusions.size() == 0) {
if (dependencyExclusions == null || dependencyExclusions.isEmpty()) {
return false;
}
for (DependencyExclusion exclusion : dependencyExclusions) {
Expand All @@ -243,7 +243,7 @@ boolean matchesExcludedDependency(Artifact artifact, DependencyExclusion exclusi
}

private String defaultAndTrim(String string) {
return defaultString(trim(string), "");
return Objects.toString(trim(string), "");
}

private void applyExclusions(Artifact artifact, Dependency dep) {
Expand All @@ -268,7 +268,6 @@ void writeModel(Model pomModel, File outputFile) throws MojoExecutionException {
MavenXpp3Writer mavenWriter = new MavenXpp3Writer();
mavenWriter.write(writer, pomModel);
} catch (IOException e) {
e.printStackTrace();
throw new MojoExecutionException("Unable to write pom file.", e);
}
}
Expand Down
14 changes: 13 additions & 1 deletion it3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@
<id>run-its</id>
<build>
<plugins>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<executions>
<execution>
<id>check</id>
<goals>
<goal>check</goal>
</goals>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
Expand All @@ -59,7 +72,6 @@
<goal>generate-resources</goal>
</goals>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<mavenHome>${it.maven.home}</mavenHome>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>bom-builder-maven-plugin</artifactId>
<groupId>eu.maveniverse.maven.plugins</groupId>
<artifactId>bom-builder3</artifactId>
<version>@pom.version@</version>
<executions>
<execution>
Expand All @@ -59,6 +59,7 @@
<bomGroupId>org.test</bomGroupId>
<bomArtifactId>junit-bom</bomArtifactId>
<bomVersion>1.0</bomVersion>
<useDependencies>true</useDependencies>
<exclusions>
<exclusion>
<dependencyGroupId>org.apache.maven</dependencyGroupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>bom-builder-maven-plugin</artifactId>
<groupId>eu.maveniverse.maven.plugins</groupId>
<artifactId>bom-builder3</artifactId>
<version>@pom.version@</version>
<executions>
<execution>
Expand All @@ -64,6 +64,7 @@
<bomGroupId>org.test</bomGroupId>
<bomArtifactId>junit-bom</bomArtifactId>
<bomVersion>1.0</bomVersion>
<useDependencies>true</useDependencies>
<addVersionProperties>true</addVersionProperties>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>bom-builder-maven-plugin</artifactId>
<groupId>eu.maveniverse.maven.plugins</groupId>
<artifactId>bom-builder3</artifactId>
<version>@pom.version@</version>
<executions>
<execution>
Expand All @@ -55,6 +55,7 @@
<bomGroupId>org.test</bomGroupId>
<bomArtifactId>junit-bom</bomArtifactId>
<bomVersion>1.0</bomVersion>
<useDependencies>true</useDependencies>
</configuration>
</execution>
</executions>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions it3/it/basic-bom/pom.xml → it3/src/it/basic-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>bom-builder-maven-plugin</artifactId>
<groupId>eu.maveniverse.maven.plugins</groupId>
<artifactId>bom-builder3</artifactId>
<version>@pom.version@</version>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>bom-builder-maven-plugin</artifactId>
<groupId>eu.maveniverse.maven.plugins</groupId>
<artifactId>bom-builder3</artifactId>
<version>@pom.version@</version>
<executions>
<execution>
Expand All @@ -60,6 +60,7 @@
<bomGroupId>org.test</bomGroupId>
<bomArtifactId>junit-bom</bomArtifactId>
<bomVersion>1.0</bomVersion>
<useDependencies>true</useDependencies>
<dependencyExclusions>
<dependencyExclusion>
<groupId>org.apache.maven</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>bom-builder-maven-plugin</artifactId>
<groupId>eu.maveniverse.maven.plugins</groupId>
<artifactId>bom-builder3</artifactId>
<version>@pom.version@</version>
<executions>
<execution>
Expand All @@ -61,6 +61,7 @@
<bomArtifactId>junit-bom</bomArtifactId>
<bomVersion>1.0</bomVersion>
<usePropertiesForVersion>true</usePropertiesForVersion>
<useDependencies>true</useDependencies>
</configuration>
</execution>
</executions>
Expand Down

0 comments on commit cd41823

Please sign in to comment.