maven not downloading google-gson - maven-3

I haved added the below lines in my pom.xml.Still I can't find gson-2.2.4.jar in my local maven repository.
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
<scope>compile</scope>
</dependency>
What can be the possible reason for this.? The version of Maven that I am using is
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_NZ, platform encoding: UTF-8
OS name: "linux", version: "3.5.0-37-generic", arch: "amd64", family: "unix"

Related

Pipeline Script Jenkins

Here is my pipeline jenkins
pipeline {
agent any
stages{
stage('clone and clean repo'){
steps {
bat "git clone https://github.com/developper-root/my-app"
bat "mvn clean -f my-app"
}
}
I have this error:
'mvn' is not recognized as an internal command
or external, an executable program or a batch file.
But, this command works
C:\Users\ASUS>mvn --version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T12:57:37+01:00)
Maven home: C:\Users\ASUS\Desktop\Esprit\Ressources JEE\Semaine 1\Outils - JEE\Maven\apache-maven-
3.3.3\bin\..
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_60\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"
Kind regards.
Okay two things here.
When using -f flag you specify the pom.xml file so your command should be
mvn -f pom.xml clean package
Secondly if you're executing multiple line in bat file use below syntax
stage ('Build repo') {
steps {
bat '''
cd folder to pom.xml
mvn clean package
'''
}
}
It seems that MVN_HOME environment variable is not properly set. Are you running the script on Jenkins master directly? If so check if you have MVN_HOME set in Windows. If you are running this script on some slave, check if maven is installed on that machine.

What provides PageUtils and PagedIterable for the Bitbucket API?

I am trying to find what provides the packages:
com.atlassian.bitbucket.util.PageUtils;
com.atlassian.bitbucket.util.PagedIterable;
I have looked in:
Bitbucket API
Bitbucket SCM Common
Bitbucket SPI
The PageUtils class is part of bitbucket-util jar. https://packages.atlassian.com/maven-external/com/atlassian/bitbucket/server/bitbucket-util/
Just add a dependency
<dependency>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-util</artifactId>
<scope>provided</scope>
</dependency>

Jenkins's maven release plugin - How to set parent project version?

I have a multi-modules project that I want to release with Jenkins. I use Maven 3.3.1, Jenkins 1.651.3 and maven-release-plugin 0.14.0
I create one job for the parent project and one job for each sub project.
Here is the parent configuration :
pom.xml :
<groupId>parent.group.id</groupId>
<artifactId>parent-artifact</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<scm>
<url>http://mygitrepo/parent-project.git</url>
<connection>scm:git:git://mygitrepo/parent-project.git</connection>
<developerConnection>scm:git:http://mygitrepo/parent-project.git</developerConnection>
</scm>
Jenkins config :
When I perform maven release for the parent project, it works.
Now I do the same thing for a sub project.
pom.xml :
<parent>
<groupId>parent.group.id</groupId>
<artifactId>parent-artifact</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<scm>
<url>http://mygitrepo/sub-project.git</url>
<connection>scm:git:git://mygitrepo/sub-project.git</connection>
<developerConnection>scm:git:http://mygitrepo/sub-project.git</developerConnection>
</scm>
With the same Jenkins config. I got this error :
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project sub-project: Can't release project due to non released dependencies :
[ERROR] parent.group.id:parent-artifact:pom:1.0.0-SNAPSHOT
The plugin doesn't seem to replace the parent version by the release version.
I read in the maven release plugin's documentation that I can use "-Dproject.dev" and "-Dproject.rel" to specify the parent version to use.
So I tried this :
-Dproject.dev.parent.group.id:parent-artifact=1.0.1-SNAPSHO
-Dproject.rel.parent.group.id:parent-artifact=1.0.0
release:clean release:prepare release:perform -X
-Dproject.dev.parent.group.id:parent-artifact:pom=1.0.1-SNAPSHOT
-Dproject.rel.parent.group.id:parent-artifact:pom=1.0.0
release:clean release:prepare release:perform -X
-Dproject.dev.parent.group.id:parent-artifact:pom:1.0.0-SNAPSHOT=1.0.1-SNAPSHOT
-Dproject.rel.parent.group.id:parent-artifact:pom:1.0.0-SNAPSHOT=1.0.0
release:clean release:prepare release:perform -X
None of this solve the problem.
How can I configure Jenkins plugin to set the parent-project version ?
As an alternative you could use the Versions Maven Plugin to set the parent version in an own build step:
mvn versions:update-parent
or to set a specific version
mvn versions:update-parent "-DparentVersion=[1.2.0]"

How to upgrade rest API in docker?

I have following docker engine and API version.
{
"ApiVersion": "1.17",
"Arch": "amd64",
"GitCommit": "a8a31ef",
"GoVersion": "go1.3.3",
"KernelVersion": "3.19.0-30-generic",
"Os": "linux",
"Version": "1.5.0"
}
It shows the Engine version as 1.5.0 but the API version as 1.17. How should I upgrade the API to version 1.21?
I am using ubuntu 15.04.
Thanks.
https://docs.docker.com/installation/ubuntulinux/#installation
API version 1.21 is not released yet, but you can upgrade to 1.20 by following the steps at that url

Call Ant jar target from Gradle build file

How can I call the Ant target 'jar' from the Gradle build file? I've tried a number of things to no avail. Renaming the 'jar' target in the Ant build file is not an option. I'm in the process of converting an Ant based build system to Gradle and the first required step is to call all the Ant targets from Gradle.
The 'jar' task is a default Gradle task so I'm overwriting/overriding it but I need to call my similarly named Ant target.
Gradle build.gradle file:
// Prevents error "Cannot add task {taskname} as a task with that name already exists"
ant.project.addTarget('clean', new org.apache.tools.ant.Target())
ant.project.addTarget('jar', new org.apache.tools.ant.Target())
ant.project.addTarget('test', new org.apache.tools.ant.Target())
ant.project.addTarget('javadoc', new org.apache.tools.ant.Target())
ant.importBuild 'build.xml'
task jar(overwrite: true) {
println 'jar'
}
task clean(overwrite: true) {
println 'clean'
}
task test(overwrite: true) {
println 'test'
}
and my Ant build.xml:
<target name='jar' description='jar'>
<echo>Called jar task in ant build</echo>
</target>
Running Gradle v1.2
------------------------------------------------------------
Gradle 1.2
------------------------------------------------------------
Gradle build time: Wednesday, September 12, 2012 10:46:02 AM UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy: 2.2.0
JVM: 1.6.0_25 (Sun Microsystems Inc. 20.0-b11)
OS: Linux 2.6.37.6 amd64
Gradle only adds a jar task when you apply the Java plugin, which you shouldn't do for the project into which you import the Ant build. I don't think you should ever call ant.project.addTarget from a Gradle build script.

Resources