Created
May 18, 2012 14:49
-
-
Save saltnlight5/2725656 to your computer and use it in GitHub Desktop.
Maven Tips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Build helper plugin adds additional classpath into test phase (test) --> | |
<plugin> | |
<groupId>org.codehaus.mojo</groupId> | |
<artifactId>build-helper-maven-plugin</artifactId> | |
<version>1.7</version> | |
<executions> | |
<execution> | |
<phase>process-resources</phase> | |
<configuration> | |
<resources> | |
<resource> | |
<directory>${project.basedir}/config/${configName}</directory> | |
</resource> | |
</resources> | |
</configuration> | |
<goals> | |
<goal>add-test-resource</goal> | |
</goals> | |
</execution> | |
</executions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# Deploy a jar file into nexus server as third party lib. You must have your $HOME/.m2/settings.xml setup | |
# with server id nexus-server. | |
# | |
# Usage: mvn-deploy-file.sh <groupId> <artifactId> <version> <jar-file> | |
echo "Installing third party jar $4 into Nexus as $1:$2:$3" | |
mvn deploy:deploy-file -DrepositoryId=nexus-server \ | |
-DgroupId=$1 -DartifactId=$2 -Dversion=$3 \ | |
-Durl=http://localhost:8080/nexus/content/repositories/thirdparty \ | |
-Dpackaging=jar \ | |
-Dfile="$(cygpath -w $4)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# Install a jar file into Local Maven Repo. | |
# | |
# Usage: mvn-install-file.sh <groupId> <artifactId> <version> <jar-file> | |
echo "Installing third party jar $4 into Local Maven Repo as $1:$2:$3" | |
mvn install:install-file \ | |
-DgroupId=$1 -DartifactId=$2 -Dversion=$3 \ | |
-Dpackaging=jar \ | |
-Dfile="$(cygpath -w $4)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Grap all the surefire reports (TXT) files and parse out their test name and elapse time. | |
# | |
import os, os.path, glob, sys | |
show_failed = False | |
def process(fh, name): | |
filename = os.path.basename(name) | |
lines = fh.readlines() | |
if (len(lines) == 0): | |
if(show_failed): | |
print("FAILED 0000.0 %s" % filename) | |
return | |
test_name = lines[1].split(' ')[2].rstrip() | |
status_words = lines[3].split(' ') | |
if (status_words[-1].rstrip() == 'FAILURE!'): | |
time_in_sec = status_words[-4] | |
status = "FAILED" | |
else: | |
time_in_sec = status_words[-2] | |
status = "PASSED" | |
if (status == 'FAILED' and not show_failed): | |
return | |
time_in_sec = time_in_sec.replace(',', '') | |
print("%s %06.1f %s" % (status, float(time_in_sec), test_name)) | |
for dir in sys.argv[1:]: | |
for name in glob.glob( os.path.join(dir, '*.txt') ): | |
fh = open(name, 'r') | |
process(fh, name) | |
fh.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment