Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gastaldi/shrinkwrap-extensions

A ShrinkWrap archive implementation for Maven projects
https://github.com/gastaldi/shrinkwrap-extensions

Last synced: 5 days ago
JSON representation

A ShrinkWrap archive implementation for Maven projects

Awesome Lists containing this project

README

        

ShrinkWrap Maven Project
========================

This shrinkwrap implementation allows you to model a Maven project including its sources as a ShrinkWrap archive. It uses https://github.com/forge/roaster[Roaster] and the Apache Maven Model API.

== Usage Example

[source,java]
----
// This would create an Archive representation of the project
MavenProjectArchive archive = ShrinkWrap.create(MavenProjectArchive.class);

// Set the pom.xml using a org.apache.maven.model.Model instance
Model model = new Model();
model.setGroupId("org.example");
model.setArtifactId("foo");
model.setVersion("1.0.0-SNAPSHOT");
archive.setPom(mavenModel);

// Add a class to src/main/java
archive.add(Roaster.create(JavaClassSource.class).setName("Foo").setPackage("com.example.demo"));

// Add a class to src/test/java
MavenTestProjectArchive testArchive = archive.as(MavenTestProjectArchive.class);
testArchive.add(Roaster.create(JavaClassSource.class).setName("FooTest").setPackage("com.example.demo"));

// We can export this to a ZIP file
archive.as(ZipExporter.class).exportTo(new File("project.zip"), true);

// Or we can explode in a specified location
archive.as(ExplodedExporter.class).exportExplodedInto(new File("/tmp/demo"));
----