Appending JVM parameter to the parameter specified explicitly in plugin configuration? - maven-3

Sometimes I need the parameter to be appended, instead of overriding the one in configuration:
for instance
mvn test -DargLine="-Dportal.test=huge"
should be added to
<argLine>-XX:+CMSClassUnloadingEnabled</argLine>
so the result would equal to
<argLine>-XX:+CMSClassUnloadingEnabled -Dportal.test=huge</argLine>
Could please anybody tell me if it is possible and how ?
EDIT: Please don't answer with " Why would you want to do that" kind of annoying questions.

I have never used argLine but maybe this is what you are looking for.. i.e.:
<argLine>-DskipTests=true ${argLine}</argLine>
(I used skip tests as an example :))

Related

How to keep expressions in HandleBars.Net for later evaluation?

This seems to be a simple matter and maybe it's solved already, but I'm not sure how to do it. I'd like to keep arbitrary unresolved expressions for later evaluation. Note that I still don't know which expressions are already defined.
For example, suppose I have the expression...
{{source.path}}/mainmenu{{ext}}"
...and the context defines ext as .js, but source.path is still undefined. What I get is/mainmenu.js", but I'd like to get {{source.path}}/mainmenu.js" instead so that I can evaluate {{source.path}} at a later time. HandlebarsConfiguration.UnresolvedBindingFormatter seemed promising, but it doesn't handle the complete original expression. HandlebarsConfiguration.ExpressionNameResolver also didn't help.
So, is it possible to do this at all? Thanks in advance for any help.

Is there a way to order properties in a maven archetype? [duplicate]

Anybody knows is it possible to make substitution for default value of one requredProperty to another in archetype-metadata.xml ?
So, I try to do something like this:
<requiredProperty key="name"/>
<requiredProperty key="groupId">
<defaultValue>com.mycompamy.${name}</defaultValue>
</requiredProperty>
But when I start to generate project from artifact in interactive mode, maven asks me about groupId property first. But not for name as I expected.
Is it possible to change this behaviour?
Your problem is caused by required property loading order. Maven loads every custom required property in alphabetical order. You probably cant change it. But there are 2 ways which will solve your problem:
Renaming ur variables like this:
"0_name"
"1_groupId"
Now it will ask you about name firstly.
Use full maven command, passing only name parameter
mvn archetype:generate -DarchetypeGroupId=?? -DarchetypeArtifactId=?? -DgroupId=?? -DartifactId=?? -Dversion=?? -Dpackage=?? -Dname=??
Replace ?? with valid parameters
Hope it will helps you.
EDIT: now i see an asked time. Pretty offtopic but maybe it will help someone else

Access process i18n property files before compilation

I have a following situation: in some of my i18n property files there are properties containing a special word:
prop.example=specialword just for example
prop.test=just for test specialword
I want to have a possibility of having a property somewhere in my Config.groovy that would contain a specific value for this specialword so that if I specify:
specialword=Value of special word
in a Config.groovy then I want my i18n properties to be resolved like:
prop.example=Value of special word just for example
prop.test=just for test Value of special word
for that purpose, when building the project, I want to access property files in order to look for occurences of specialword and to replace them with value of specialwordvalue from Config.groovy.
Is that possible somehow? Perhaps, someone faced similar situation? I would really appreciate any help.
Thanks, Cheers
Instead of trying to change the way the properties are compiled, you would be better off passing the special value as an argument to your message code (as discussed in the comments to your question).
For instance:
<g:message code="my.key.code" args="[someVariableWithAValueFromConfig]" />
If your message code doesn't use the argument it will simply be ignored. This seems like the best approach to the problem you are trying to solve.

How to set explain option?

If you issue this command to informix server, the server will just generate explain and won't run the query. Great feature if your query doesn't end at all.
SET EXPLAIN ON AVOID_EXECUTION;
If you issue this command to informix then the Explain file will be generated at that location .
SET EXPLAIN FILE TO 'c:\temp\sql.out';
But, I need both options on and I can't figure out the syntax for doing that. If I execute both statements then the latter overrides the former.
Execute first the SET EXPLAIN FILE TO 'c:\temp\sql.out';, this way you set the target.
Then you change to avoid execution : SET EXPLAIN ON AVOID_EXECUTE;;

How do I perform if/else operations in a jenkins workflow build?

I'm sure there's an easy answer for this but I was unable to find it elsewhere.
I have a Jenkins workflow job with parameters. What I want is to skip a build job depending on the value of a parameter. Something like:
if(param["MYPARAM"]){
build("jorb1")
}
build("jorb2")
Does anyone know how I'd accomplish this?
Turns out the answer is really easy. Hopefully this will help someone else. If statements do work in the DSL configuration. I guess its based on groovy (which I have zero experience with). Anyway my guess was just about right other than specifying the params incorrectly. Below is an example of checking a string parameter:
if(params["MYPARAM"]=="some_value"){
build("jorb1")
}
build("jorb2")

Resources