Skip to content

Instantly share code, notes, and snippets.

@martiell
Created June 7, 2012 16:01
Show Gist options
  • Save martiell/2889674 to your computer and use it in GitHub Desktop.
Save martiell/2889674 to your computer and use it in GitHub Desktop.
Write pom dependencies to a file
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.0</version>
<configuration>
<source>
// Write the compile/runtime classpath to a file, with one entry per line.
// Each line contains the relative path to a jar from the root of a Maven
// repository.
layout = new org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout()
scopes = [ 'compile', 'runtime' ]
artifacts = project.artifacts.
findAll { scopes.contains(it.scope) }.
collect { layout.pathOf(it) }
dir = new File(project.build.directory,
"generated-resources/classpath/")
dir.mkdirs()
new File(dir, "classpath.txt").withWriter { w ->
artifacts.each { w.println it }
}
</source>
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment