Permalink
Browse files

Some additional fixes

  • Loading branch information...
1 parent 13acad2 commit c0987304d76e9d4ba8c1129421ec41139bb45bfa @dhanji dhanji committed May 21, 2012
@@ -16,13 +16,6 @@
package org.sonatype.maven.polyglot.atom;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
@@ -34,6 +27,13 @@
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.sonatype.maven.polyglot.io.ModelWriterSupport;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
@Component(role = ModelWriter.class, hint = "atom")
public class AtomModelWriter extends ModelWriterSupport {
@@ -51,7 +51,6 @@ public void write(final Writer output, final Map<String, Object> options, final
project(pw, model);
id(pw, model);
parent(pw, model);
- packaging(pw, model);
properties(pw, model);
dependencyManagement(pw, model);
dependencies(pw, model);
@@ -83,7 +82,8 @@ private void project(PrintWriter pw, Model model) {
if (name == null) {
name = model.getArtifactId();
}
- pw.println("project \"" + name + "\" @ \"" + model.getUrl() + "\"");
+ pw.print("project \"" + name + "\" @ \"" + model.getUrl() + "\"");
+ packaging(pw, model);
}
private void id(PrintWriter pw, Model model) {
@@ -101,19 +101,17 @@ private void id(PrintWriter pw, Model model) {
private void parent(PrintWriter pw, Model model) {
if (model.getParent() != null) {
- pw.print(indent + "inherit: " + model.getParent().getGroupId() + ":" + model.getParent().getArtifactId() + ":" + model.getParent().getVersion());
+ pw.print(indent + "inherits: " + model.getParent().getGroupId() + ":" + model.getParent().getArtifactId() + ":" + model.getParent().getVersion());
if (model.getParent().getRelativePath() != null) {
//pw.println(":" + model.getParent().getRelativePath());
- pw.println(":" + "../pom.atom");
- } else {
- pw.println();
+// pw.println(":" + "../pom.atom");
}
+ pw.println();
}
}
private void packaging(PrintWriter pw, Model model) {
- pw.println(indent + "packaging: " + model.getPackaging());
- pw.println();
+ pw.println(" as " + model.getPackaging());
}
private void properties(PrintWriter pw, Model model) {
@@ -182,11 +180,11 @@ private void deps(PrintWriter pw, String elementName, List<Dependency> deps) {
// We are assuming the model is well-formed and that the parent is providing a version
// for this particular dependency.
//
- pw.print(d.getGroupId() + ":" + d.getArtifactId());
+ pw.print(d.getGroupId() + ":" + d.getArtifactId());
}
if (d.getClassifier() != null) {
pw.print("(" + d.getClassifier() + ")");
- }
+ }
if (i + 1 != deps.size()) {
pw.println();
}
@@ -222,7 +220,6 @@ private void plugins(PrintWriter pw, String elementName, List<Plugin> plugins) {
pw.println();
Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
if (configuration.getChildCount() != 0) {
- pw.print(" properties:[ ");
int count = configuration.getChildCount();
for (int j = 0; j < count; j++) {
Xpp3Dom c = configuration.getChild(j);
@@ -236,7 +233,6 @@ private void plugins(PrintWriter pw, String elementName, List<Plugin> plugins) {
}
}
}
- pw.print(" ]");
}
}
if (i + 1 != plugins.size()) {
@@ -247,4 +243,4 @@ private void plugins(PrintWriter pw, String elementName, List<Plugin> plugins) {
pw.println();
}
}
-}
+}

0 comments on commit c098730

Please sign in to comment.