maven 安装本地jar
mvn install:install-file -Dfile={Path/to/your/ojdbc.jar} -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
解析pom.xml
var base64PomXml = `
base64 encode pom.xml data
`
var xml = Base64.decode(base64PomXml)
var dom = $.parseXML(xml)
$(xml.replace(/\$\{(.*?)\}/g, (match, name)=>{
var tags = dom.getElementsByTagName(name)
return (tags.length == 0)?match:tags[0].innerHTML
})).find('dependency').map((num, item)=>{
var artifactId = $(item).find('artifactId')[0].innerText
var version = $(item).find('version')[0].innerText
var groupId = $(item).find('groupId')[0].innerText
return `mvn install:install-file -Dfile=${artifactId}-${version}.jar -DgroupId=${groupId} -DartifactId=${artifactId} -Dversion=${version} -Dpackaging=jar`
}).toArray().join('\n')
format = require 'string-format'
format.extend(String.prototype)
xml="""
pom.xml data
"""
x=$ xml
dependencys = x.find 'dependency'
groups=[]
dependencys.each (num,item)->
# console.log no
g=$(item).find('groupId')[0]
groups.push item # if 'com.xxxx' == g.innerText
resultArr=[]
groups.forEach (item) ->
x=$(item)
# <dependency>
# <groupId>org.jdom</groupId>
# <artifactId>jdom</artifactId>
# <version>1.1</version>
# </dependency>
tem='mvn install:install-file -Dfile={artifactId}-{version}.jar -DgroupId={groupId} -DartifactId={artifactId} -Dversion={version} -Dpackaging=jar'
obj={}
obj.artifactId=x.find('artifactId')[0].innerText
obj.version=x.find('version')[0].innerText
obj.groupId=x.find('groupId')[0].innerText
resultArr.push(tem.format(obj))
console.log resultArr.join '\n'