Skip to content

Instantly share code, notes, and snippets.

@bbrowning
Created November 13, 2015 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbrowning/69568d527d363f9c1549 to your computer and use it in GitHub Desktop.
Save bbrowning/69568d527d363f9c1549 to your computer and use it in GitHub Desktop.
public BuildTool projectArtifact(String groupId, String artifactId, String version, String packaging, File file) {
System.err.println("!!! PROJECT ARTIFACT " + artifactId);
Archive ogArchive = ShrinkWrap.create(JavaArchive.class);
try {
ogArchive.as(ZipImporter.class).importFrom(new JarFile(file));
Path webResources = Paths.get(System.getProperty("user.dir"), "src", "main", "webapp");
System.err.println("!!! LOOKING FOR " + webResources);
if (Files.exists(webResources)) {
System.err.println("!!! ADDING WEB RESOURCES BUDDY");
ogArchive.as(ExplodedImporter.class).importDirectory(webResources.toFile());
}
} catch (Exception e) {
System.err.println("!!! oops");
e.printStackTrace();
}
this.projectAsset = new ArchiveAsset(ogArchive);
// this.projectAsset = new ArtifactAsset(new ArtifactSpec(null, groupId, artifactId, version, packaging, null, file));
return this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment