diff options
author | zongyu <zzy2529420793@gmail.com> | 2020-08-03 10:37:54 +0800 |
---|---|---|
committer | zongyu <zzy2529420793@gmail.com> | 2020-08-03 10:40:52 +0800 |
commit | 22348c9c8ef160aab32ed4231cd45279ec56cdd2 (patch) | |
tree | 55545f938d782414f74c38472e71a50458531ae3 /src | |
parent | reformat the license/name string (diff) | |
download | java-ebuilder-22348c9c8ef160aab32ed4231cd45279ec56cdd2.tar.gz java-ebuilder-22348c9c8ef160aab32ed4231cd45279ec56cdd2.tar.bz2 java-ebuilder-22348c9c8ef160aab32ed4231cd45279ec56cdd2.zip |
add default{Desciption,Homepage}
Signed-off-by: zongyu <zzy2529420793@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java | 33 |
1 files changed, 25 insertions, 8 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 646fc13..1fde760 100644 --- a/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java +++ b/src/main/java/org/gentoo/java/ebuilder/maven/MavenEbuilder.java @@ -19,6 +19,17 @@ import org.gentoo.java.ebuilder.Config; public class MavenEbuilder { /** + * The fallback description if no description is found in pom.xml. + */ + private static final String defaultDescription = "${MAVEN_ID}"; + + /** + * The fallback homepage if no homepage is found in pom.xml. + */ + private static final String defaultHomepage + = "https://wiki.gentoo.org/wiki/No_homepage"; + + /** * EAPI version. */ private static final String EAPI = "7"; @@ -694,10 +705,22 @@ public class MavenEbuilder { final MavenProject mavenProject, final PrintWriter writer) { writer.println(); + // write MAVEN_ID ahead of DESCRIPTION, + // becase defaultDescription need ${MAVEN_ID} + writer.print("MAVEN_ID=\""); + writer.print(mavenProject.getGroupId()); + writer.print(':'); + writer.print(mavenProject.getArtifactId()); + writer.print(':'); + writer.print(mavenProject.getVersion()); + writer.println('"'); + writer.print("DESCRIPTION=\""); if (mavenProject.getDescription() != null) { writer.print(mavenProject.getDescription().replace("\"", "\\\"")); + } else { + writer.print(defaultDescription); } writer.println('"'); @@ -706,6 +729,8 @@ public class MavenEbuilder { if (mavenProject.getHomepage() != null) { writer.print(mavenProject.getHomepage()); + } else { + writer.print(defaultHomepage); } writer.println('"'); @@ -736,14 +761,6 @@ public class MavenEbuilder { writer.print("KEYWORDS=\""); writer.print(config.getKeywords()); writer.println('"'); - - writer.print("MAVEN_ID=\""); - writer.print(mavenProject.getGroupId()); - writer.print(':'); - writer.print(mavenProject.getArtifactId()); - writer.print(':'); - writer.print(mavenProject.getVersion()); - writer.println('"'); } /** |