我有两个项目是一个共同的父项目的孩子。 还有一个发电机项目和相应的发电机maven插件项目。 此外,两个子项目都使用相同的输入文件,用于代码生成:
parent: pom child1: jar src/main/generator/input.gen child2: jar src/main/generator/input.gen generator: jar generator-plugin: maven-plugin生成器插件是一个内部制作的Maven插件:
@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,这个input.gen在src/main/generator/input.gen和src/main/generator/input.gen的src/main/generator/input.gen中重复。 这是个问题。 我想只有一个版本的input.gen 。
我应该如何构建我的项目以及如何在<configuration><input>...</input></configuration>为两个子项目的pom中的generator-plugin插件引用此共享副本?
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-pluginThe 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?
最满意答案
Maven远程资源插件可能正是您所需要的。
这是一个例子 。
The Maven Remote Resources Plugin might be what you're looking for.
Here is an example.
更多推荐
发布评论