Skip to content

Commit

Permalink
Add travis files
Browse files Browse the repository at this point in the history
  • Loading branch information
ralscha committed Dec 7, 2013
1 parent 7a71dcb commit a1dcbde
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: java
env:
global:
- SONATYPE_USERNAME=ralscha23
- secure: RiyNF3cW/HnO5/olysHLVAsEZeGEkE0BS6+ZduDTQUkr4VGJRYAaPtLdkwHVsojT0GcZQrQ4+3ciQwgxwhVeAQKkUfAk5rMAS8KvNXxZg3iXeTjkXr+RtE67SV4fQaeoWHKRvTrvW2NUzMCc1VM6zIwBpsjNazUxI0P3K2b/UBQ=
after_success:
- python addsettings.py
- mvn clean deploy -DskipTests=true --settings ~/.m2/mySettings.xml
45 changes: 45 additions & 0 deletions addsettings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python
import sys
import os
import os.path
import xml.dom.minidom

if os.environ["TRAVIS_SECURE_ENV_VARS"] == "false":
print "no secure env vars available, skipping deployment"
sys.exit()

homedir = os.path.expanduser("~")

m2 = xml.dom.minidom.parse(homedir + '/.m2/settings.xml')
settings = m2.getElementsByTagName("settings")[0]

serversNodes = settings.getElementsByTagName("servers")
if not serversNodes:
serversNode = m2.createElement("servers")
settings.appendChild(serversNode)
else:
serversNode = serversNodes[0]

sonatypeServerNode = m2.createElement("server")
sonatypeServerId = m2.createElement("id")
sonatypeServerUser = m2.createElement("username")
sonatypeServerPass = m2.createElement("password")

idNode = m2.createTextNode("sonatype-nexus-snapshots")
userNode = m2.createTextNode(os.environ["SONATYPE_USERNAME"])
passNode = m2.createTextNode(os.environ["SONATYPE_PASSWORD"])

sonatypeServerId.appendChild(idNode)
sonatypeServerUser.appendChild(userNode)
sonatypeServerPass.appendChild(passNode)

sonatypeServerNode.appendChild(sonatypeServerId)
sonatypeServerNode.appendChild(sonatypeServerUser)
sonatypeServerNode.appendChild(sonatypeServerPass)

serversNode.appendChild(sonatypeServerNode)

m2Str = m2.toxml()
f = open(homedir + '/.m2/mySettings.xml', 'w')
f.write(m2Str)
f.close()
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@
<exclude>**/*.txt</exclude>
<exclude>**/*.md</exclude>
<exclude>**/*.json</exclude>
<exclude>**/*.py</exclude>
<exclude>**/*.yml</exclude>
<exclude>**/.gitignore</exclude>
</excludes>
<strictCheck>true</strictCheck>
Expand Down

0 comments on commit a1dcbde

Please sign in to comment.