From 4110f1dcb9bc4123d906f8330ca19339c4149c30 Mon Sep 17 00:00:00 2001 From: Geert Bevin Date: Thu, 11 May 2023 08:36:47 -0400 Subject: [PATCH] Added publish-local command --- src/main/java/rife/bld/Project.java | 19 +++++++++++++++++++ .../java/rife/bld/help/PublishLocalHelp.java | 16 +++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/main/java/rife/bld/Project.java b/src/main/java/rife/bld/Project.java index 8f12be1..5fdd0e7 100644 --- a/src/main/java/rife/bld/Project.java +++ b/src/main/java/rife/bld/Project.java @@ -4,6 +4,7 @@ */ package rife.bld; +import rife.bld.dependencies.Repository; import rife.bld.help.*; import rife.bld.operations.*; @@ -192,4 +193,22 @@ public class Project extends BaseProject { jarJavadoc(); publishOperation().executeOnce(() -> publishOperation().fromProject(this)); } + + /** + * Standard publish-local command, transfers artifacts to the local maven repository. + * + * @since 17 + */ + @BuildCommand(value = "publish-local" ,help = PublishLocalHelp.class) + public void publishLocal() + throws Exception { + jar(); + jarSources(); + jarJavadoc(); + publishOperation().executeOnce(() -> { + var repositories = publishOperation().fromProject(this).repositories(); + repositories.clear(); + repositories.add(Repository.MAVEN_LOCAL); + }); + } } diff --git a/src/main/java/rife/bld/help/PublishLocalHelp.java b/src/main/java/rife/bld/help/PublishLocalHelp.java index 189c01c..6f73352 100644 --- a/src/main/java/rife/bld/help/PublishLocalHelp.java +++ b/src/main/java/rife/bld/help/PublishLocalHelp.java @@ -8,21 +8,23 @@ import rife.bld.CommandHelp; import rife.tools.StringUtils; /** - * Provides help for the publish command. + * Provides help for the publish-local command. * * @author Geert Bevin (gbevin[remove] at uwyn dot com) - * @since 1.5.7 + * @since 1.7 */ -public class PublishHelp implements CommandHelp { +public class PublishLocalHelp implements CommandHelp { public String getSummary() { - return "Publishes the artifacts of your project"; + return "Publishes to the local maven repository"; } public String getDescription(String topic) { return StringUtils.replace(""" - Publishes the artifacts of the project to the publication - repository. - The standard publish command will automatically also execute + Publishes the artifacts of the project to local maven repository, + regardless of the repositories that are set up in your publish + operation. + + The standard publish-local command will automatically also execute the jar, jar-sources and jar-javadoc commands beforehand. Usage : ${topic}""", "${topic}", topic);