thomasf / drone-mvn

Maven repository artifact publisher for Drone CI
Apache License 2.0
6 stars 3 forks source link

Pull Version from pom.xml #2

Closed graywolf336 closed 8 years ago

graywolf336 commented 8 years ago

Is there anyway to pull the version from the pom.xml file? Or what would you recommend for this?

thomasf commented 8 years ago

Not really.

I wrote this plugin to publish artifacts to maven repositories from non java/maven builds. If you are using maven in the first place can't you just let maven do the complete cycle in your build step instead?

graywolf336 commented 8 years ago

Okay thanks.

That's how we started off trying, but I couldn't find a way to get it working with a password protected repository as I couldn't find a way to create the settings.xml with the usernames and passwords. You have any tips on doing that?

thomasf commented 8 years ago

IIRC, the only way I found how to do provide maven with credentials was to generate a settings.xml.

It wouldn't be that much work supporting running any maven command in this plugin but unfortunately I don't have time to implement it right now..

You could maybe use a bash script which wraps the maven invocation and creates the settings.xml before maven is launched during the build step.. This solution does "leak" the credentials early on in the build process so you might want to be careful depending on how public the project is.

The wrapper could maybe look something like this where the M2_PASSWORD is injected in to the builder environment via drone secrets.

#!/bin/bash

echo cat << EOF > $HOME/.m2/settings.xml
<settings>
... $M2_PASSWORD ...
</settings>
EOF

mvn ${@}
graywolf336 commented 8 years ago

I will have to try that out, thanks!