Wednesday 15 June 2011

Correct way to modify maven plugin configuration from mojo -


I know that this is subjective question and it will most likely stop but I do not know to get an answer to this question. To where is it from

There is a small problem with the Maven Android plugin - it modifies the original manifest file, and if you are running Maven in the Tasks folder, then your VCS is offering you these changes. .

Example: If I create a build with the beta environment, then we have many environments to run, it will modify the app name in AndroidManifest.xml .

It can be easily solved by imitating the copy and reference of the copy can refer to the Android maven plugin. But I have decided to make it easier for the developer so that the plugin will do this by leaving the situation automatically when the developer specifies that he wants to make this update under the original manifest.

Modifying this functionality was easy to replace and replace the file that resides in the context of the file) The problem is that I need to pass this property to other mojos.

Abstract Mojo AbstractAndroidMojo T execute is the method and all other mojos extend this class. Definition looks like this:

  / ** * & lt; Code & gt; AndroidManifest.xml & lt; / Code & gt; File. * * @ Parameter default-value = "$ {project.basedir} /AndroidManifest.xml" * / protected file androidManifestFile;   

I followed it:

  Private Zero Update Plugin Configuration (string newmapfile value) {for (plugin plugin: project.getBuild (). GetPlugins ( )) {If (Plugin.getArtifactId (.) Equals ("android-maven-plugin")) {Xpp3Dom Configuration = (Xpp3Dom) plugin.getConfiguration (); Xpp3Dom manifestFileParameter = Configuration .getChild ("androidManifestFile"); If (manifestFileParameter == faucet) {manifestFileParameter = New Xpp3Dom ("Android Manifest File"); Configuration.addChild (manifestFileParameter); } ManifestFileParameter.setValue (newManifestFileValue); break; }}}   

But unfortunately it does not work. There are many clear ways to do this work but all of them have to change all the current moons.

I wonder if someone knows why the answer does not work or how it works.

The update plugin's code can be found here:

Thanks to everyone who has been reading till the end.

Are you running your goal within the same lifecycle phase? If not, then it has been written in your written post:

Note: Any configuration changes are discarded at the end of the current stage.

Another thing to consider: Do you expect that targets are goals? Take a look at this post: - It's probably the order of those plugins that you have problems with.

Consider other things: Perhaps you prefer cleaner solutions - adding this feature to Android-maven-plugin? Manfred Moser is usually open for proposals supported by pull requests;)

The difference I'm most likely doing the same thing in my plugin is the only difference that I copy the dependency within my custom plugin lifecycle To re-use the target from the Maven-dependency-plugin. I am trying to create a plugin for the InstallShield project building.

No comments:

Post a Comment