I have two projects that are children of a common parent project. There is also a generator project and the corresponding maven plugin project for the generator. In addition, both child projects use the same input file that is used to generate the code:
parent: pom
child1: jar
src/main/generator/input.gen
child2: jar
src/main/generator/input.gen
generator: jar
generator-plugin: maven-plugin
Generator plugin - built-in 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 one is input.genduplicated in src/main/generator/input.genboth child1, and child2. This is problem. I would like to have only one version input.gen.
How do I structure my projects and how should I refer to this shared copy in <configuration><input>...</input></configuration>for the plugin generator-pluginin pom of two child projects?
source
share