install.bat:
@SET mvn=d:\java\maven\bin\mvn
@%mvn% install:install-file -DgroupId=com.google.gdata
-DartifactId=%1 -Dversion=%2 -Dfile=%3 -Dpackaging=jar
-DgeneratePom=true
installall.bat:
call install.bat gdata-analytics 2.0 gdata-analytics-2.0.jar
call install.bat gdata-appsforyourdomain 1.0 gdata-appsforyourdomain-1.0.jar
call install.bat gdata-base 1.0 gdata-base-1.0.jar
call install.bat gdata-blogger 2.0 gdata-blogger-2.0.jar
call install.bat gdata-books 1.0 gdata-books-1.0.jar
call install.bat gdata-calendar 1.0 gdata-calendar-2.0.jar
call install.bat gdata-client 1.0 gdata-client-1.0.jar
call install.bat gdata-codesearch 2.0 gdata-codesearch-2.0.jar
call install.bat gdata-contacts 3.0 gdata-contacts-3.0.jar
call install.bat gdata-core 1.0 gdata-core-1.0.jar
call install.bat gdata-docs 2.0 gdata-docs-2.0.jar
call install.bat gdata-finance 2.0 gdata-finance-2.0.jar
call install.bat gdata-health 2.0 gdata-health-2.0.jar
call install.bat gdata-maps 2.0 gdata-maps-2.0.jar
call install.bat gdata-media 1.0 gdata-media-1.0.jar
call install.bat gdata-photos 2.0 gdata-photos-2.0.jar
call install.bat gdata-spreadsheet 3.0 gdata-spreadsheet-3.0.jar
call install.bat gdata-webmastertools 2.0 gdata-webmastertools-2.0.jar
call install.bat gdata-youtube 2.0 gdata-youtube-2.0.jar
You surely could get fancy and automate the splitting between artifact-name and version number, but hey, I needed those JARs installed quickly and that's what it does.
A better solution would be to get a repository manager and upload the artifacts (or automate this with the deploy:deploy-file goal).
AntwortenLöschenI'd suggest nexus: http://nexus.sonatype.org
an even better solution would be to write a script that iterates over all files, parses their name and decides the values of the parameters.
AntwortenLöschenTake a look at this project: http://github.com/dcarter/Google-Data-APIs-Mavenized It contains a script to generate poms with full dependency information for all the gdata jars, and instructions for using the jars/poms that are hosted on a Sonatype public repository. Soon the project will be syncing these artifacts to the Maven central repo.
AntwortenLöschenAn even better solution would be to stop using Maven at all.
AntwortenLöschenHello,
AntwortenLöschenI have pushed a bit further my gdata maven repository stored on google code http://code.google.com/p/mandubian-mvn following David Carter idea based on Tattletale to extract dependencies and generate the Poms automatically. I have also added a Nexus Index to this repository and version up to 1.41.3 are currently mavenized! Have fun! Pascal
ahghgh...those "while()" blocks above should be "while(<cmd>)"
AntwortenLöschenHere's another variant on the windows theme, but for those *nix/osx inclined. Assuming you grab the "gdata-java.xxx.zip" file from http://code.google.com/p/gdata-java-client/downloads/list, here's a couple scripts I wrote to help install those from their exploded location into your company's repo:
AntwortenLöschen{code}
install.pl
#!/usr/bin/perl -w
my $artifactId=$ARGV[0];
my $version=$ARGV[1];
my $jar=$ARGV[2];
die "must supply artifactId, version and jar on command line" unless ($artifactId && $version && $jar);
my $cmd = "/usr/share/maven-2.1.0/bin/mvn deploy:deploy-file -DgroupId=com.google.gdata -DartifactId=$artifactId -Dversion=$version -Dfile=$jar -Dpackaging=jar -DgeneratePom=true -Durl=file:/// -Drepository=";
print "executing command = $cmd\n";
open(CMD, "$cmd|") or die "Could not exec $cmd $!";
while() {
print $_;
}
close(CMD);
{code}
installall.pl
{code}
#!/usr/bin/perl -w
my @jars = `ls *.jar`;
chomp(@jars);
foreach my $jar (@jars) {
#print "found jar $jar\n";
if($jar =~ /(.*)-(\d\.\d)\.jar/) {
#print "\tartifact is $1 and version is $2\n";
my $cmd = "./install.pl $1 $2 $jar";
open(CMD, "$cmd|") or die "Could not execute $cmd $!";
while() {
print $_;
}
close(CMD);
}
}
{code}