Deploy Maven version on Github using Travis CI

I was able to successfully deploy the JAR from the maven project to Github using tags. However, the current configuration assumes that the JAR file name always remains unchanged, which is not the case. When I make a new release, it will change accordingly, so the deployment will fail.

Is there a way I can use wildcards in a YAML file? From what I found here on Stackoverflow and the web, wildcards are not supported in YAML. I could not find another hack for this without manipulating the .travis.yml file itself, which I would like to avoid.

The version string is available in pom.xml .

Current .travis.yml:

 language: java jdk: - openjdk7 deploy: provider: releases api_key: secure: asfdsdflkjsdflkj... file: target/helloci-1.0-SNAPSHOT.jar on: repo: ktk/helloci all_branches: true tags: true 

I could, of course, script that somehow, but then Travis CI will change its own configuration file, and I'm not sure if this will work and b) it is a good idea.

Repo I play with: https://github.com/ktk/helloci

+5
github maven deployment travis-ci
Sep 18 '14 at 15:04
source share
3 answers

Wildcards are now supported, I run this setup:

 before_deploy: - "mvn -DskipTests package" - export FOO=$(ls target/foo-version-*.jar) deploy: provider: releases api_key: secure: yep file: "${FOO}" 
+2
Sep 18 '15 at 11:52
source share

Work to ensure that maven generates a file using a fixed name, this can be done with

 <build> <finalName>helloci</finalName> </build> 

However, you probably want to keep the name in accordance with the maven rules if you are not building on travis-ci. You can achieve this by adding the following to your pom:

 <properties> <finalName>${project.artifactId}-${project.version}</finalName> </properties> <build> <finalName>${finalName}</finalName> 

And passing -DfinalName=helloci when executing maven, adding the following 2 lines to your .travis.yml file:

 before_install: mvn install -DskipTests=true -DfinalName=helloci install: mvn test 

You can also add the tag name to the name of the generated file. This can be achieved with:

 before_install: mvn install -DskipTests=true -DfinalName=helloci-$TRAVIS_TAG deploy: file: target/helloci-$TRAVIS_TAG.jar 
+9
Sep 20 '14 at 14:20
source share

Sorry, lookup patterns do not work at the moment, but we will consider the possibility of doing this on Travis CI.

+1
Sep 19 '14 at 15:52
source share



All Articles