In application.properties I want to use variables as below.
quarkus.datasource.db-kind=${DATASOURCE_DB_KIND}
quarkus.datasource.jdbc.url=jdbc:postgresql://${DB_URL}:${DB_PORT}/${DB_DATABASENAME}?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory&sslmode=require
quarkus.datasource.username=${DB_USERID}
quarkus.datasource.password=${DB_PWD}
But when I run a build
./mvnw clean package
getting error
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.5.2.Final:build (default) on project graphql-mp: Failed to build quarkus application: java.util.NoSuchElementException: Property DATASOURCE_DB_KIND not found
This fails because you didn't define the environment variable DATASOURCE_DB_KIND.
If you want it to be able to work without one defined, you need to set a default value and use something like ${DATASOURCE_DB_KIND:yourdefaultvalue}.
Related
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
I try to create a Griffon application as described at
http://griffon-framework.org/tutorials/1_getting_started.html#_tutorial_1_2
Using:
Gradle 2.9
lazybones 0.8.3
mvn 3.3.9
Entered:
lazybones create griffon-swing-java sample
Define value for 'group' [org.example]:
Define value for 'artifactId' [sample]:
Define value for 'version' [0.1.0-SNAPSHOT]:
Define value for 'griffonVersion' [2.7.0]:
Define value for 'package' [org.example]:
Define value for 'className' [Sample]:
Project created in sample!
cd sample
gradle run
Gives this error:
FAILURE: Build failed with an exception.
* Where:
Script '/home/username/dev/griffon_prj/sample/gradle/integration-test.gradle' line: 20
* What went wrong:
A problem occurred evaluating script.
> Could not find property 'compileOnly' on configuration container.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Am I missing something?
It sounds like a gradle configuration/script error, the gradle 2.9 version could the be problem, the tutorial mentions 2.14.
IMHO you should install gradle 2.14.1, it works fine.
I followed this tutorial and did a groovy-swing app without any problem with lazybones 0.8.3 and gradle 2.14.1.
You can have several gradle installations, each one in it's own directory, without any problem, just to take care of the path and GRADLE_HOME if you use command line (you will for the tuto).
When I try to build a maven project on eclipse, I get this error:
-Dmaven.multiModuleProjectDirectory system property is not set.
Check $M2_HOME environment variable and mvn script match.
Set MAVEN_OPTS = -Dmaven.multiModuleProjectDirectory
If you are developing application on Eclipse RCP and trying to build any project using any procedure (e.g. embedded maven -- by creating your own launch configuration file), then you will have to set "MavenLaunchConstants.ATTR_POM_DIR" attribute, provided the value of project path.
Code for reference :
ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(launchFileFolder, launchFileName); workingCopy.setAttribute(MavenLaunchConstants.ATTR_POM_DIR, <project_path>);
I'm getting this error when trying to do a maven build:
[INFO] An Ant BuildException has occured: The following error occurred while executing this line:
C:\[[project]]\build.xml:17:
settingsFile does not exist: C:\[[project]]\${env.M2_HOME}\conf\settings.xml
Is this the same as M2.HOME? How do I set it when I don't have access to environment variables due to silly IT security policies in my company? Is it possible to set it within the project using IntelliJ IDEA?
It's the M2_HOME environment variable.
export M2_HOME=/path/to/maven
Or since you're on Windows (sorry):
set M2_HOME=c:/path/to/maven
I'm trying to set up a Jenkins multi configuration job for the selenium tests of my project that runs against multiple browsers. I checked the different options and the multi configuration job seems to be a good fit, but I cannot make maven pass the parameters correctly to maven.
I have a few parameters I need to pass to maven, mainly browserName and appDomain, and also a Profile to run the tests. To configure the job I do the following:
Define the SVN repository from where the code will be checked out.
Set up browserName as a user define axis, with values FIREFOX, CHROME, IE.
Create a build step of type "Invoke top-level Maven targets", and here's where I get the problems. The configuration of this part is different from other job types, usually there's a field called Goals and Options where to put everything, but in this case is divided in different fields. So I don't know where exactly put the properties and the profile.
a) The logical thing, I put the goals in Goals field and the parameters and options in the properties field, like in the image:
In this case the job runs normally without executing the tests, because the profile is not executed.
b) If I put just the profile in the Goals field, the maven call in the log is:
/opt/apache-maven-2.2.1/bin/mvn -DbrowserName=CHROME "-D-Dappdomain=0 -Dtestenv=test -Drc=true -DsuiteXmlFile=testOne.xml -U -Dapp.instance.key=jenkins -Denv=default" clean verify -Pwebtests
And the exception is:
[INFO] [enforcer:enforce {execution: enforce-property}]
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireProperty failed with message:
You must pass the appdomain as parameter! Example: -Dappdomain=20
[WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireProperty failed with message:
You must pass the test environment as parameter! Example: -Dtestenv=beta
So is not getting the properties
c) Finally, if I put everything in the goals field, I get the following exception:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] One or more required plugin parameters are invalid/missing for 'property:merge'
[0] Inside the definition for plugin 'property-maven-plugin' specify the following:
<configuration>
...
<environment>VALUE</environment>
</configuration>
-OR-
on the command line, specify: '-Denv=VALUE'
I tried with a normal and parametrized job and works perfectly...
Jenkins version is: 1454 and Maven is 2.2.1
I found out that the Jenkins machine wasn't properly configured. I tried in another instance and was all good with the following configuration:
-Goals: clean verify Pwebtests
-Paramenters: (properties file format)
appDomain=0
testenv=test
env=default
....
And as a sidenote, the other jobs were working because they were using the Jenkins Maven plugin, which seems to use java to launch a Hudson class that calls Maven, instead of calling directly the mvn command, which is what happens when a build step of type "Invoke top-level Maven Targets"