So I'm trying use a Python script to get some information out of Jenkins after it's done with a Maven build, but the Maven environment variables that are supposed to be set (see here) are not. Anyone know whats up? I'm using the latest version of Jenkins.
I just realized that the version that supports environment variables isn't out yet.
Related
I have a JavaFX project I am working on using Gradle. What version of java is used when I use the gradle run task from the application plugin?
In IntelliJ I can go into the Gradle settings and change the "Gradle JVM" to any version I want. Is this just the version of java that is used to run the build? Or is this also the version that my application will be run on?
Where does my JAVA_HOME come into this, if at all?
Irrespective of IDEs, Gradle will use whatever language level of the JVM that is running Gradle. Typically whatever the value is for JAVA_HOME.
See Environment variables and Targeting a specific Java version
The new way to do it as of Gradle 6.7 is to use Toolchains for JVM projects
Your IDE should respect whatever Gradle configuration that is configured.
I have a project that is setup as a job to build in Jenkins.
This project has multiple Maven modules.
One of the Maven module has a Maven task, which runs a Java program.
This Java program requires an environment variable which is available in the system.
When I run the Maven build cycle for that module locally in the terminal of the same system, the Java program is able to read the environment variable.
However in the Jenkins build, the Maven task fails as it is not being able to access that environment variable.
Is there anything else that I need to make this env variable visible to Jenkins Maven. I have tried restarting Jenkins after setting the env var, but to no avail.
I have this below line in a batch script in my Jenkins build job, which downloads a specific artifact from nexus server.
call mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -DrepoUrl=http://10.101.2.23:8081/nexus/content/repositories/releases/ -Dartifact=test:update-service:1.0.3 -Ddest=Setups/Services/update-service.jar
Here I have hardcoded the latest version available at Nexus. Is it possible to get the latest version available at nexus using a jenkins variable? If so how? Please advice.
use "LATEST" for latest snapshot version or "RELEASE" for latest release version. In your case
call mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -DrepoUrl=http://10.101.2.23:8081/nexus/content/repositories/releases/ -Dartifact=test:update-service:RELEASE -Ddest=Setups/Services/update-service.jar
so you don't need a jenkins variable to inject a variable.
since you are using jenkins, my advice is to use the "Artifact Resolver"
hope this helps.
If you want to use a global variable in Jenkins, go to Manage Jenkins > Configure System > Global properties. Check Environment variables and enter your key value pair. You can then use the global variable in your jobs with the syntax $key or ${key}.
I use the git-describe maven plugin to replace the POMs <version>${describe}</version> placeholder. mvn deploy needs a custom parameter passed in order for it to properly use the actual git describe value.
I'm now using Jenkins to build the project every time we push to the repo however it too doesn't properly use the actual git-describe value.
The jenkins build artifacts always end named project-${describe}
Are there any suggestions on ways I can customize the file names or force it to use the git-describe result? Otherwise I may be back to manual versioning...
The version property does not allow variable substitution. The first link I found googling this was this SO question.
You'll have to use one of the versioning maven plugins. The maven release plugin is the most popular, but you might find that the versions maven plugin better meets your requirements.
I am using the tomcat plugin to start Tomcat server using a war file i have built using the war plugin.
Before the app starts i need to set some environment variables.
Is there a way to do that?
From what I can see in the Gradle Tomcat plugin docs, the plugin runs Tomcat in the Gradle process. Environment variables for that process can only be set from outside Gradle, in a manner appropriate for your environment/OS. Alternatively, you might want to look into the Gradle Cargo and Gradle Arquillian plugins, which can also run containers in an external process.
PS: Please don't double-post here and on http://forums.gradle.org.