restx.build.IvySupport Maven / Gradle / Ivy
package restx.build;
import java.io.IOException;
import java.io.Writer;
import java.util.Map;
/**
* User: xavierhanin
* Date: 4/14/13
* Time: 2:08 PM
*/
public class IvySupport implements RestxBuild.Generator {
private String eaVersion = "0.9";
public void generate(ModuleDescriptor md, Writer w) throws IOException {
w.write("\n");
w.write(" \n");
String buildType = md.getPackaging().equals("war") ? "build-webapp-java" : "build-std-java";
w.write(" entry : md.getProperties().entrySet()) {
if (entry.getKey().equals("java.version")) {
w.write(" compile.java.source.version=\"" + entry.getValue() + "\"\n");
w.write(" compile.java.target.version=\"" + entry.getValue() + "\"\n");
} else if (entry.getKey().endsWith(".version")) {
// versions are inlined, no need to put them here
} else {
w.write(" " + entry.getKey() + "=\"" + entry.getValue() + "\"\n");
}
}
w.write(" />\n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n");
w.write(" \n");
for (String scope : md.getDependencyScopes()) {
for (ModuleDependency dependency : md.getDependencies(scope)) {
String groupId = dependency.getGav().getGroupId();
String version = RestxBuildHelper.expandProperty(dependency.getGav().getVersion(), "module.version", md.getGav().getVersion());
String expandedVersion = RestxBuildHelper.expandProperties(md.getProperties(), version);
if (expandedVersion.endsWith("-SNAPSHOT")) {
expandedVersion = "latest.integration";
}
w.write(String.format(" \n",
groupId, dependency.getGav().getArtifactId(),
expandedVersion,
"compile".equals(scope) ? "default" : scope +"->default"));
}
}
w.write(" \n");
w.write(" \n");
}
@Override
public String getDefaultFileName() {
return "module.ivy";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy