Beispiel #1
0
 @Override
 public boolean install() {
   if (!isInstalled()) {
     MavenModelResource pom = getModelResource();
     if (!pom.createNewFile()) throw new IllegalStateException("Could not create POM file.");
     pom.setContents(createDefaultPOM());
   }
   return isInstalled();
 }
Beispiel #2
0
 @Override
 public void setModel(final Model pom) {
   MavenXpp3Writer writer = new MavenXpp3Writer();
   ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
   MavenModelResource modelResource = getModelResource();
   try (Writer fw = new OutputStreamWriter(outputStream)) {
     writer.write(fw, pom);
     modelResource.setContents(outputStream.toString());
   } catch (IOException e) {
     throw new RuntimeException(
         "Could not write POM file: " + modelResource.getFullyQualifiedName(), e);
   } finally {
     buildManager.evictFromCache(modelResource);
   }
 }