In mvn, how do I pass the object store key command? - maven

How can we pass the persistent object store 'true' value through mvn command to get the trick mark in runtime manager for RTF applications? As of now, we are not passing objectstore through the pom file, but we need to do so through Jenkins script.
CMD: mvn deploy –DmuleDeploy -DobjectStore = true
Will this cmd -DobjectStore = true work or are there any other options?

Using the Mule Maven Plugin for Mule 4 in the <deployementSetting> section add the element <persistentObjectStore>. Its value will be the property that you are defining in the command line. For example:
<persistentObjectStore>${objectStore}</persistentObjectStore>
Then you can define the property value in the command line to set it to true or false: mvn deploy -DobjectStore=true ...

Related

Spring properties: spring.config.additional-location not verriden property values

I'm using this command line in order to start my service locally:
mvn -pl rep-digital-api clean compile spring-boot:run \
-Dspring-boot.run.arguments=--spring.config.additional-location=front-pre-props.properties
pre profile is activated since front-pre-props.properties contains spring.profiles.active=pre.
Into default application-dev.properties I've set this property:
api.path-web=web
Nevertheless, I need to simulate pre profile into my local environment. So I need to change this property value:
api.path-web=other-path
Nevertheless, this property is not overriden.
Also I've tested it seting -Dapi.path-web=other-value in to mvn command, but it doesn't work...
Any ideas?
If you are trying to add a file from the file system, you need to set the value of property spring.config.additional-location to file:/pathtofile/yourfile.properties.
Lets say your file front-pre-props.properties is in path /Users/demo/front-pre-props.properties
Then you can execute the run command as :
mvn -pl rep-digital-api -Dspring.config.additional-location=“file:/Users/demo/front-pre-props.properties” clean compile
spring-boot:run

Pass liquibase parameters to gradle liquibase 'update' task

I want to pass username, password and url liquibase parameters as a command line parameters to gradle's liquibase update task.
I have followed liquibase-gradle-plugin to configure the plugin.
What I actually want to achieve is, pass these database parameters at runtime instead of hardcoding them in liquibase.properties file.
I can do this by exporting these three values as environment variables and access them in build.gradle. But I want to achieve this using commandline parameters.
I tried
gradle update --url=jdbc:postgresql://localhost:5432/liquibase_cmd_test --username=### --password=### -PrunList=main
but it gives error as
Unknown command-line option '--url'.
I think that underneath gradle is Java, so you should be able to do something like this. The -D argument sets a system property.
gradle -Dliquibase.url=<your url> -Dliquibase.username=<username> -Dliquibase.password=<password> update -PrunList=main

Providing system properties via command line with dot in the name in Gradle

We are migrating our project from Maven to Gradle. Our CI uses system properties like -Dwebdriver.type=firefox to set certain behaviour thus we don't want to hardcode such props in gradle.properties file etc. Is there a way to provide a system property with a dot in the name using command line?
If you run the following:
build.gradle:
logger.lifecycle("some.property ${System.properties['some.property']}")
with:
gradle -Dsome.property=lol
It should give you the expected output.

How to pass more than one argument in the same property in maven command line

I'm trying to run automation test using maven command.
my property for running a specific test is -DtestsToExecute
I can run a single test by passing the test name to this property:
mvn clean verify -DtestsToExecute=UITest
How can I run more than one test at once? I mean how can I pass more than one argument to the same property? I've tried putting comma between the different tests name, but with no success:
mvn clean verify -DtestsToExecute=UITest1,UITest2

Using Maven property inside TeamCity Build Step

I would like to use a property, which I defined inside my pom.xml. Now I would like to refer to this property value inside my TeamCity Build Step.
At the moment I'm only able to refer the other way around to use a TeamCity property inside Maven.
In particular I want to do a SSH Deployer with a target like url/path/%maven.output.type%/something with
<properties>
<!-- Art der Entwicklung -->
<output.type>testing</output.type>
</properties>
What I tried was to define a parameter in TeamCity but I have no idea how to define the value of this parameter.
Is there any way to use this property inside the TeamCity build?
You can run a script that will set a teamcity parameter that you can use in a another build step. Here are the build configuration settings I use:
Create a configuration parameter with an empty text value with a name used in the next step (e.g. outputType).
Add a build step, with runner type Command line:
Select to run a custom script.
In the custom script field, enter a script that will extract the value from the pom file, and tell teamcity to set it in the parameter. For example:
testing=sed -n 's:.*<output\.type>\(.*\)</output\.type>.*:\1:p' pom.xml
echo "##teamcity[setParameter name='outputType' value='$testing']"
This will set the teamcity parameter outputType with the value of an element named output.type found in the current project pom file.
In another build step, you can use that parameter in a field like, for instance, the target field:
somepath/%outputType%

Resources