2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-25 08:17:11 -07:00

Added publish-local command

This commit is contained in:
Geert Bevin 2023-05-11 08:36:47 -04:00
parent b5bacbf9cf
commit 4110f1dcb9
2 changed files with 28 additions and 7 deletions

View file

@ -4,6 +4,7 @@
*/ */
package rife.bld; package rife.bld;
import rife.bld.dependencies.Repository;
import rife.bld.help.*; import rife.bld.help.*;
import rife.bld.operations.*; import rife.bld.operations.*;
@ -192,4 +193,22 @@ public class Project extends BaseProject {
jarJavadoc(); jarJavadoc();
publishOperation().executeOnce(() -> publishOperation().fromProject(this)); 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);
});
}
} }

View file

@ -8,21 +8,23 @@ import rife.bld.CommandHelp;
import rife.tools.StringUtils; 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) * @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() { public String getSummary() {
return "Publishes the artifacts of your project"; return "Publishes to the local maven repository";
} }
public String getDescription(String topic) { public String getDescription(String topic) {
return StringUtils.replace(""" return StringUtils.replace("""
Publishes the artifacts of the project to the publication Publishes the artifacts of the project to local maven repository,
repository. regardless of the repositories that are set up in your publish
The standard publish command will automatically also execute operation.
The standard publish-local command will automatically also execute
the jar, jar-sources and jar-javadoc commands beforehand. the jar, jar-sources and jar-javadoc commands beforehand.
Usage : ${topic}""", "${topic}", topic); Usage : ${topic}""", "${topic}", topic);