use of org.eclipse.ceylon.aether.apache.maven.model.io.xpp3.MavenXpp3Reader in project maven-archetype by apache.
the class DefaultPomManager method readPom.
public Model readPom(InputStream pomStream) throws IOException, XmlPullParserException {
Reader pomReader = ReaderFactory.newXmlReader(pomStream);
MavenXpp3Reader reader = new MavenXpp3Reader();
return reader.read(pomReader);
}
use of org.eclipse.ceylon.aether.apache.maven.model.io.xpp3.MavenXpp3Reader in project maven-archetype by apache.
the class DefaultPomManager method readPom.
public Model readPom(final File pomFile) throws IOException, XmlPullParserException {
Model model;
Reader pomReader = null;
try {
pomReader = ReaderFactory.newXmlReader(pomFile);
MavenXpp3Reader reader = new MavenXpp3Reader();
model = reader.read(pomReader);
} finally {
IOUtil.close(pomReader);
}
return model;
}
use of org.eclipse.ceylon.aether.apache.maven.model.io.xpp3.MavenXpp3Reader in project maven-archetype by apache.
the class DefaultArchetypeGeneratorTest method readPom.
private Model readPom(final File pomFile) throws IOException, XmlPullParserException {
Reader pomReader = null;
try {
pomReader = ReaderFactory.newXmlReader(pomFile);
MavenXpp3Reader reader = new MavenXpp3Reader();
return reader.read(pomReader);
} finally {
IOUtil.close(pomReader);
}
}
use of org.eclipse.ceylon.aether.apache.maven.model.io.xpp3.MavenXpp3Reader in project maven-plugins by apache.
the class InstallFileMojoTest method testInstallFileWithGeneratePom.
public void testInstallFileWithGeneratePom() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/install-file-test-generatePom/plugin-config.xml");
InstallFileMojo mojo = (InstallFileMojo) lookupMojo("install-file", testPom);
assertNotNull(mojo);
setVariableValueToObject(mojo, "session", createMavenSession());
assignValuesForParameter(mojo);
mojo.execute();
File installedArtifact = new File(getBasedir(), LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + "." + packaging);
assertTrue((Boolean) getVariableValueFromObject(mojo, "generatePom"));
assertTrue(installedArtifact.exists());
File installedPom = new File(getBasedir(), LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + "." + "pom");
Model model;
Reader reader = null;
try {
reader = ReaderFactory.newXmlReader(installedPom);
model = new MavenXpp3Reader().read(reader);
reader.close();
reader = null;
} finally {
IOUtil.close(reader);
}
assertEquals("4.0.0", model.getModelVersion());
assertEquals((String) getVariableValueFromObject(mojo, "groupId"), model.getGroupId());
assertEquals(artifactId, model.getArtifactId());
assertEquals(version, model.getVersion());
assertEquals(5, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
}
use of org.eclipse.ceylon.aether.apache.maven.model.io.xpp3.MavenXpp3Reader in project maven-plugins by apache.
the class ProcessRemoteResourcesMojo method getSupplement.
protected Model getSupplement(Xpp3Dom supplementModelXml) throws MojoExecutionException {
MavenXpp3Reader modelReader = new MavenXpp3Reader();
Model model = null;
try {
model = modelReader.read(new StringReader(supplementModelXml.toString()));
String groupId = model.getGroupId();
String artifactId = model.getArtifactId();
if (groupId == null || groupId.trim().equals("")) {
throw new MojoExecutionException("Supplemental project XML " + "requires that a <groupId> element be present.");
}
if (artifactId == null || artifactId.trim().equals("")) {
throw new MojoExecutionException("Supplemental project XML " + "requires that a <artifactId> element be present.");
}
} catch (IOException e) {
getLog().warn("Unable to read supplemental XML: " + e.getMessage(), e);
} catch (XmlPullParserException e) {
getLog().warn("Unable to parse supplemental XML: " + e.getMessage(), e);
}
return model;
}
Aggregations