Skip to content

Commit

Permalink
feat: rename task from pom to maven
Browse files Browse the repository at this point in the history
  • Loading branch information
teletha committed Jan 6, 2024
1 parent f03cb70 commit a055260
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
55 changes: 28 additions & 27 deletions src/main/java/bee/api/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,35 @@ public boolean equals(Object obj) {
}

/**
* {@inheritDoc}
* Returns literal project definition.
*
* @return
*/
@Override
public String toString() {
public List<String> toBeeDefinition() {
List<String> code = Inputs.templates("""
{=${ }=}
import static bee.api.License.*;
public class Project extends bee.api.Project {
{
product("${group}", "${product}", "${version}");
license(${license.name});
${#versionControlSystem}
versionControlSystem("${versionControlSystem}");
${/versionControlSystem}
}
}
""", this);

return StandardHeaderStyle.SlashStar.convert(code, license);
}

/**
* Returns literal of POM file.
*
* @return
*/
public String toMavenDefinition() {
XML pom = I.xml("project");
pom.child("modelVersion").text("4.0.0");
pom.child("groupId").text(getGroup());
Expand Down Expand Up @@ -879,30 +904,6 @@ public String toString() {
return pom.toString();
}

/**
* Returns literal project definition.
*
* @return
*/
public List<String> toBeeDefinition() {
List<String> code = Inputs.templates("""
{=${ }=}
import static bee.api.License.*;
public class Project extends bee.api.Project {
{
product("${group}", "${product}", "${version}");
license(${license.name});
${#versionControlSystem}
versionControlSystem("${versionControlSystem}");
${/versionControlSystem}
}
}
""", this);

return StandardHeaderStyle.SlashStar.convert(code, license);
}

/**
* Return the reference of the specified file's text.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bee/task/IDE.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private void task(Consumer<IDESupport> task) {
if (support.exist(project)) {
task.accept(support);

require(POM::build);
require(Maven::pom);
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import bee.Task;
import bee.api.Command;

public class POM extends Task {
public class Maven extends Task {

@Command("Generate pom file.")
public void build() {
makeFile("pom.xml", project.toString());
public void pom() {
makeFile("pom.xml", project.toMavenDefinition());
}
}

0 comments on commit a055260

Please sign in to comment.