invoke maven pluginManagment objects by reference
I have not found a way to do this, but it seems like a feature that sh开发者_C百科ould exist. Is it possible to invoke a maven-2 plugin by inherited reference? For example I would like to be able to do something like the following (yes I know you can't do this):
<pluginManagment>
<plugin id="exec-inno-setup">
<artifactId>maven-exec-plugin...
<executions>...
<configuration>...</configuration
<executions>
</plugin>
And somewhere in my child POM, I want to do something like:
<pluginRef id="exec-inno-setup">
<configuration>
<script>someFile.iss</script>
</configuration>
</pluginRef>
The question is: is there some way to do this, (or come close).
The workaround to your problem is to use maven properties. I'll admit I haven't tried this but I believe it should work...
In your parent you would do something like this...
<pluginManagment>
<plugin>
<artifactId>maven-exec-plugin</artifactId>
...
<executions>
...
<configuration>
<script>${maven.exec.plugin.config.script}</script>
</configuration>
<executions>
</plugin>
</pluginManagment>
And then in your child project, you just need to define the property...
<properties>
<maven.exec.plugin.config.script>someFile.iss</maven.exec.plugin.config.script>
</properties>
This will only work where you childrens' config looks the exact same everywhere except for a few values. If you have different options you need set depending, this won't do it for you and you will have to define the entire plugin and it's configuration in each child pom.xml file.
精彩评论