Every repository with this icon (
Every repository with this icon (
| Description: | Maven CLI Plugin edit |
-
profiles are not activated for cli:execute-phase
3 comments Created 6 months ago by mojavelinuxIt appear that the cli:execute-phase don't activate profiles that are passed in from the command line. This is unfortunate because it means I cannot leverage this plugin for scenarios such as deployment that rely on other plugins and dependencies specified in a profile.
I'm looking for something like:
bash$ cli:execute-phase -Prun-integration-tests
maven2> testYou can easily verify that profiles are not activated by examining the output of help:effective-pom once in the command console. When I run tests, the run-integration-tests configuration does not take affect.
Comments
-
unable to run resources:testResources from cli context
1 comment Created 7 months ago by nodjeIt seems the goal testResources is missing from the cli context.
Or at least I'm unable to trigger it.The following goal chain should be enough to run the test, but it fials inmy case because test resources aren't copied:
resources compile testCompile test
Shouldn't be enough to run the test? Or should a testResources goal be introduced?
Comments
mojavelinux
Tue May 05 10:11:33 -0700 2009
| link
The following line should be added to the defaultAliases map of ExecuteCliMojo:
put("testResources", "org.apache.maven.plugins:maven-resources-plugin:testResources");
As a workaround, you can just spell out the command:
org.apache.maven.plugins:maven-resources-plugin:testResources
-
I have been able to verify that profiles are properly activated when using cli:execute based on the command line flag or activation trigger. However, the configuration in the profile doesn't seem to take affect.
Case in point. I have an antrun configuration in a profile. I activate that profile using -P
bash$ mvn cli:execute -Pexplode
maven2> runant(runant is an alias to the antrun plugin). None of the ant tasks are run.
Comments
-
User properties cannot be overriden using cli:execute-phase
10 comments Created 6 months ago by jcarsiqueSetting properties through command line or cli console doesn't work (-Dproperty=value).
A workaround would be to define a profile per property group to set but it doesn't cover all needs.
Version tested is 0.6.3.CR2.Comments
mojavelinux
Tue May 05 06:46:36 -0700 2009
| link
Please note that 0.6.3.CR2 is a version hosted at the JBoss Maven repository from my fork: http://github.com/mojavelinux/maven-cli-plugin/tree
mojavelinux
Tue May 05 06:39:07 -0700 2009
| link
Are you having a problem with execute or execute-phase? I'm pretty sure properties work in execute-phase.
mojavelinux
Tue May 05 06:50:42 -0700 2009
| link
You can verify by running the following in the console:
org.apache.maven.plugins:maven-help-plugin:evaluate
Then you have to type an expression, such as ${myproperty}. You'll have to deal with the lack of echo (what you type won't be shown), the press enter. The value will be outputted.
Hello,
It's with the execute-phase, still on 0.6.3.CR2 (should I use another version and deploy it into our own maven repositories) ?
The error with properties happens with already defined properties, they cannot be overridden.
To reproduce:
- define a "prop" property with value "oldvalue" in your pom - test1:mvn cli:execute-phase -Dprop=newvalue org.apache.maven.plugins:maven-help-plugin:evaluate gives "oldvalue"- test2: mvn cli:execute-phase org.apache.maven.plugins:maven-help-plugin:evaluate -Dprop=newvalue gives "oldvalue" Thanks,
mojavelinux
Tue May 05 08:17:48 -0700 2009
| link
Ah, so that is the error report. That you cannot override properties, not that they don't work. I think this may actually be a problem in Maven, but don't hold me to that.
Sorry for title, that was what I meant by "user properties" versus "properties defined by default" (i just updated this issue title).
I don't have this issue with maven, the same properties are correctly overridden from command line. Do you mean the new properties' values are evaluated at a moment in maven execution process that your plugin cannot use ?
I effectively saw a lot of maven bugs about properties some years ago, do you rely on old maven api ?
mojavelinux
Tue May 05 08:23:57 -0700 2009
| link
It does use the Maven Embedder which by chance has some legacy issues. It could be a simple as just not adding the property correctly in the command line parser. I'll dig into it. I'm sure we can get it fixed up. Thanks for reporting this.
mojavelinux
Tue May 05 10:04:55 -0700 2009
| link
I did some digging. This appears to be an error deep down in Maven 2.0.x. Basically, when you run the following code:
session.getExecutionProperties().putAll(commandCall.getProperties());
project.getProperties().putAll(commandCall.getProperties());
MavenExecutionRequest request = new DefaultMavenExecutionRequest(
session.getLocalRepository(), session.getSettings(), session.getEventDispatcher(), commandCall.getCommands(), userDir.getPath(), profileManager, session.getExecutionProperties(), project.getProperties(), true);Properties props = ((DefaultMaven) embeddedMaven).getProject(new File("pom.xml"), request).getProperties();
The properties returned are those in the pom.xml. The properties assigned to the request object, either userProperties or session executionProperties do not override the values from the pom.xml. What's interesting is that the profile manager does see the properties, so the properties specified using -D can activate a profile.
I'm not sure how to fix this. Following Maven through its labyrinth gets really hairy...but at least we know what we are looking for. The return value of getProject() (which is deep inside of execute()), must show the properties as overridden. Otherwise, it won't work.
mojavelinux
Wed May 06 22:05:17 -0700 2009
| link
I am now 100% sure this is a bug in Maven 2.0 (specifically tested with 2.0.8 - 2.0.10). It has been resolved in Maven 2.1. I verified I can run this plugin under 2.1 (with a slight hack I mention elsewhere) and the properties can be overridden. So unfortunately, there is nothing the plugin can do to solve the problem in Maven 2.0.
Understood. What a pity our project are not compatible with Maven 2.1 for now. Congratulations and many thanks for your deep inspection into Maven labyrinth code. Maybe they could do some backport to fix this issue on 2.0. For now, I'll have to manage properties with profiles in order to use your nice plugin until we're able to use Maven 2.1. Thanks again.
-
don't require a fully-qualified plugin name in userAliases
0 comments Created 6 months ago by mojavelinuxI'm not sure why, but userAliases require a fully qualified plugin name (groupId:artifactId:goal) rather than the shorthand version (prefix:goal). I'm not sure why this is the case, or if it is easy to fix, but it seems rather unnecessary. I'm thinking the parser is just misreading something.
Comments
-
Once all the parsing of the command is done, execute-phase should validate that what is left is either a valid life-cycle goal or property plugin syntax (i.e., groupId:artifactId:goal). That way, it doesn't try to execute gibberish.
Comments
mojavelinux
Tue May 05 10:13:42 -0700 2009
| link
Btw, the list of possible life-cycle goals is already a constant. It's just a matter of adding the cross-reference (and regex for plugin goals).
-
Use a history file in the user's home area to keep track of commands typed between sessions. jline supports this, so it is just a matter of calling on History to load the history file.
Comments
-
cli-plugin doesn't display details of compilation errors
0 comments Created 5 months ago by nodjeIt's difficult to work with cli-plugin when you have compilation error.
You have to switch back to regular compilation to be able to get tyhe cause of the error.Comments











I'll try to take a look at this here in the next few weeks.
Please see my fork. I've solved the problems I mention and more (such as the ability to activate a profile explicitly).
Okay. Will do. Awesome!