Reputation: 287
I have two projects which are child of a common parent project. There is also a generator project and a corresponding maven plugin project for the generator. Also, both child projects are using the same input file, which is used for the code generation:
parent: pom
child1: jar
src/main/generator/input.gen
child2: jar
src/main/generator/input.gen
generator: jar
generator-plugin: maven-plugin
The generator plugin is an in-house made Maven plugin:
@Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true)
public class GeneratorPlugin extends AbstractMojo {
@Parameter(required = true, readonly = true, defaultValue = "${project}")
private MavenProject project;
@Parameter(required = true, defaultValue = "${project.basedir}/src/main/generator/input.gen")
private File input;
...
}
Currenlty, this input.gen
is duplicated in src/main/generator/input.gen
of both child1
and child2
. This is a problem. I would like to have just one version of input.gen
.
How should I structure my projects and how should I refer to this shared copy in <configuration><input>...</input></configuration>
for the generator-plugin
plugin in the pom of the two child projects?
Upvotes: 2
Views: 1014
Reputation: 12440
My take would be (not tested):
input.gen
into a shared dependency in src/main/resources
input.gen
as provided
scope to prevent it from ending up in the final productUpvotes: 0
Reputation: 38122
The Maven Remote Resources Plugin might be what you're looking for.
Here is an example.
Upvotes: 4