Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
raydac committed Jul 31, 2019
1 parent 2f4f223 commit 5380ad0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
Sometime I develop and publish maven plugins in maven central. The Most comfortable way to organize maven plugin testing is to make a pom module hierarchy because maven keeps module build in defined order, also it allows to share common options between modules. But in the case there is some issue, all child modules have link to their parent and the parent must be published also together with children. So I developed the uber-pom plugin to make some around way.

# Changelog
__1.0.3 (31-jul-2019)
- refactoring

__1.0.2 (04-apr-2019)__
- added `removeDependencies` with wildcard support

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.igormaznitsa</groupId>
<artifactId>uber-pom</artifactId>
<version>1.0.3-SNAPSHOT</version>
<version>1.0.3</version>
<packaging>maven-plugin</packaging>

<name>UberPom</name>
Expand Down
2 changes: 1 addition & 1 deletion src/assemble/bundle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>*.jar.asc</include>
<include>*.jar</include>
Expand Down
8 changes: 4 additions & 4 deletions src/assemble/distribution.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/project</outputDirectory>
<outputDirectory>${file.separator}project</outputDirectory>
<excludes>
<exclude>target/</exclude>
<exclude>texts/</exclude>
Expand All @@ -23,21 +23,21 @@
</excludes>
</fileSet>
<fileSet>
<outputDirectory>/lib</outputDirectory>
<outputDirectory>${file.separator}lib</outputDirectory>
<directory>${project.basedir}/target</directory>
<includes>
<include>${project.build.finalName}.jar</include>
</includes>
</fileSet>
<fileSet>
<outputDirectory>/lib</outputDirectory>
<outputDirectory>${file.separator}lib</outputDirectory>
<directory>${project.basedir}</directory>
<includes>
<include>pom.xml</include>
</includes>
</fileSet>
<fileSet>
<outputDirectory>/</outputDirectory>
<outputDirectory>${file.separator}</outputDirectory>
<directory>${basedir}/texts</directory>
<includes>
<include>*.*</include>
Expand Down
32 changes: 16 additions & 16 deletions src/main/java/com/igormaznitsa/upom/DependencyPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package com.igormaznitsa.upom;

import java.util.regex.Pattern;
import jdk.nashorn.internal.objects.annotations.Property;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugins.annotations.Parameter;

/**
* Dependency pattern.
Expand All @@ -29,49 +29,49 @@ public class DependencyPattern {
/**
* Group ID, allowed wildcard pattern.
*/
@Property(name = "groupId")
@Parameter(name = "groupId")
private String groupId = null;

/**
* Artifact ID, allowed wildcard pattern.
*/
@Property(name = "artifactId")
@Parameter(name = "artifactId")
private String artifactId = null;

/**
* Version, allowed wildcard pattern.
*/
@Property(name = "version")
@Parameter(name = "version")
private String version = null;

/**
* Scope, allowed wildcard pattern.
*/
@Property(name = "scope")
@Parameter(name = "scope")
private String scope = null;

/**
* Optional flag, allowed wildcard pattern.
*/
@Property(name = "optional")
@Parameter(name = "optional")
private String optional = null;

/**
* System path, allowed wildcard pattern.
*/
@Property(name = "systemPath")
@Parameter(name = "systemPath")
private String systemPath = null;

/**
* Type, allowed wildcard pattern.
*/
@Property(name = "type")
@Parameter(name = "type")
private String type = null;

/**
* Classifier, allowed wildcard pattern.
*/
@Property(name = "classifier")
@Parameter(name = "classifier")
private String classifier = null;

private Pattern groupIdPattern;
Expand Down Expand Up @@ -159,7 +159,7 @@ public boolean maths(final Dependency dependency) {

if (this.groupId != null) {
totalCounter++;
if (dependency.getGroupId()!=null && this.groupIdPattern.matcher(dependency.getGroupId()).matches()) {
if (dependency.getGroupId() != null && this.groupIdPattern.matcher(dependency.getGroupId()).matches()) {
counter++;
}
}
Expand All @@ -171,37 +171,37 @@ public boolean maths(final Dependency dependency) {
}
if (this.version != null) {
totalCounter++;
if (dependency.getVersion()!=null && this.versionPattern.matcher(dependency.getVersion()).matches()) {
if (dependency.getVersion() != null && this.versionPattern.matcher(dependency.getVersion()).matches()) {
counter++;
}
}
if (this.classifier != null) {
totalCounter++;
if (dependency.getClassifier()!=null && this.classifierPattern.matcher(dependency.getClassifier()).matches()) {
if (dependency.getClassifier() != null && this.classifierPattern.matcher(dependency.getClassifier()).matches()) {
counter++;
}
}
if (this.type != null) {
totalCounter++;
if (dependency.getType()!=null && this.typePattern.matcher(dependency.getType()).matches()) {
if (dependency.getType() != null && this.typePattern.matcher(dependency.getType()).matches()) {
counter++;
}
}
if (this.optional != null) {
totalCounter++;
if (dependency.getOptional()!=null && this.optionalPattern.matcher(dependency.getOptional()).matches()) {
if (dependency.getOptional() != null && this.optionalPattern.matcher(dependency.getOptional()).matches()) {
counter++;
}
}
if (this.systemPath != null) {
totalCounter++;
if (dependency.getSystemPath()!=null && this.systemPathPattern.matcher(dependency.getSystemPath()).matches()) {
if (dependency.getSystemPath() != null && this.systemPathPattern.matcher(dependency.getSystemPath()).matches()) {
counter++;
}
}
if (this.scope != null) {
totalCounter++;
if (dependency.getScope()!=null && this.scopePattern.matcher(dependency.getScope()).matches()) {
if (dependency.getScope() != null && this.scopePattern.matcher(dependency.getScope()).matches()) {
counter++;
}
}
Expand Down

0 comments on commit 5380ad0

Please sign in to comment.