Created
October 2, 2012 15:20
-
-
Save Swind/3820049 to your computer and use it in GitHub Desktop.
[Scala][Script] Create Add jar to Maven Repository Command
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
import java.io.File | |
object CreateRepositoryCommand { | |
val PATH = """PATH""" | |
val command = "mvn install:install-file " + | |
"-Dfile=%s " + | |
"-DgroupId=%s " + | |
"-DartifactId=%s " + | |
"-Dversion=%s " + | |
"-Dpackaging=jar " + | |
"-DgeneratePom=true" | |
def main(args: Array[String]) { | |
val jarFolder = new File(PATH) | |
jarFolder.listFiles.foreach{ | |
file=> | |
println(command.format(file.getName,groupId(file),artifactId(file),version(file))) | |
} | |
} | |
//Example File Name : org.eclipse.core.jobs_3.5.200.v20120521-2346.jar | |
def version(file:File) = file.getName.split("_").last.replace(".jar", "") | |
def groupId(file:File) = file.getName.split("_").head.split("\\.").take(3).mkString(".") | |
def artifactId(file:File) = file.getName.split("_").head | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment