aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzongyu <zzy2529420793@gmail.com>2020-08-02 10:48:45 +0800
committerzongyu <zzy2529420793@gmail.com>2020-08-02 11:21:21 +0800
commit6f952b0dfa64958ddd6f391703995c6c97f75bce (patch)
treed66d2979dc6bab9a02fdb1387920ccbc50298868
parentupdate the recorded skeleton cmd (diff)
downloadjava-ebuilder-6f952b0dfa64958ddd6f391703995c6c97f75bce.tar.gz
java-ebuilder-6f952b0dfa64958ddd6f391703995c6c97f75bce.tar.bz2
java-ebuilder-6f952b0dfa64958ddd6f391703995c6c97f75bce.zip
create proper GENTOO_CLASSPATH for java-virtuals/*.
Signed-off-by: zongyu <zzy2529420793@gmail.com>
-rw-r--r--src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
index 810358c..646fc13 100644
--- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
+++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java
@@ -34,6 +34,12 @@ public class MavenEbuilder {
= Pattern.compile("^.*/\\$\\{P\\}-sources.((?:\\.tar)\\.\\S+|(?:\\.jar))$");
/**
+ * Pattern for checking whether the dependency is specifying versions.
+ */
+ private static final Pattern PATTERN_EBUILD_VERSIONING
+ = Pattern.compile("^[~=<>].*$");
+
+ /**
* Generates ebuild from the collected information at the specified path.
*
* @param config application configuration
@@ -88,14 +94,20 @@ public class MavenEbuilder {
sbCP.append(',');
}
- final String[] parts = dependency.getSystemDependency().
+ final String ebuildDependency =
+ dependency.getSystemDependency();
+
+ final String[] parts = ebuildDependency.
replaceAll(".*/", "").
replaceAll("\\[.*\\]", "").
split(":");
String pn = parts[0].replaceAll("-r\\d+$", "");
if (parts.length == 2) {
- pn = pn.substring(0, pn.lastIndexOf('-'));
+ if (PATTERN_EBUILD_VERSIONING.
+ matcher(ebuildDependency).matches()) {
+ pn = pn.substring(0, pn.lastIndexOf('-'));
+ }
if (!parts[1].equals("0")) {
pn += "-" + parts[1];