Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
BZ-1017886: added name and description to pom.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrenaat committed Oct 22, 2013
1 parent e5a4967 commit ddff4a0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class POM {
private static final String MODEL_VERSION = "4.0.0";

private GAV gav;
private String name;
private String description;

private List<Dependency> dependencies = new ArrayList<Dependency>();
private List<Repository> repositories = new ArrayList<Repository>();
Expand All @@ -35,8 +37,15 @@ public POM() {
this.gav = new GAV();
}

// Kept this for backwards compatibility
public POM(GAV gav) {
this(null, null, gav);
}

public POM(String name, String description, GAV gav) {
super();
this.name = name;
this.description = description;
this.gav = gav;
}

Expand All @@ -60,4 +69,19 @@ public String getModelVersion() {
return MODEL_VERSION;
}

public String getName() {
return name;
}

public void setName( String name ) {
this.name = name;
}

public String getDescription() {
return description;
}

public void setDescription( String description ) {
this.description = description;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public String toString(POM pomModel)

private String toString(POM pom, Model model)
throws IOException {
model.setName(pom.getName());
model.setDescription(pom.getDescription());
model.setGroupId(pom.getGav().getGroupId());
model.setArtifactId(pom.getGav().getArtifactId());
model.setVersion(pom.getGav().getVersion());
Expand Down Expand Up @@ -91,6 +93,8 @@ public POM toModel(String pomAsString)
Model model = new MavenXpp3Reader().read(new StringReader(pomAsString));

POM gavModel = new POM(
model.getName(),
model.getDescription(),
new GAV(
(model.getGroupId() == null ? model.getParent().getGroupId() : model.getGroupId()),
(model.getArtifactId() == null ? model.getParent().getArtifactId() : model.getArtifactId()),
Expand Down

0 comments on commit ddff4a0

Please sign in to comment.