1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 00:38:11 -07:00

New pom parsing work.

This commit is contained in:
Cedric Beust 2016-03-22 21:10:35 +04:00
parent 4a8ad75e0c
commit 0b84938a3f

View file

@ -2,7 +2,6 @@ package com.beust.kobalt.maven
import org.w3c.dom.Element import org.w3c.dom.Element
import java.io.File import java.io.File
import java.util.*
import javax.xml.bind.JAXBContext import javax.xml.bind.JAXBContext
import javax.xml.bind.annotation.XmlAnyElement import javax.xml.bind.annotation.XmlAnyElement
import javax.xml.bind.annotation.XmlElement import javax.xml.bind.annotation.XmlElement
@ -23,8 +22,8 @@ class PomProject {
var scm: Scm? = null var scm: Scm? = null
var properties: Properties? = null var properties: Properties? = null
var parent: Parent? = null var parent: Parent? = null
val dependencies = arrayListOf<Dependency>() var dependencies: Dependencies? = null
val pluginRepositories = arrayListOf<PluginRepository>() var pluginRepositories: PluginRepositories? = null
val propertyMap = hashMapOf<String, String>() val propertyMap = hashMapOf<String, String>()
fun propertyValue(s: String) : String? { fun propertyValue(s: String) : String? {
@ -50,17 +49,18 @@ class Pom2 {
println("Developer: " + pom.developers?.developers!![0].name) println("Developer: " + pom.developers?.developers!![0].name)
println("Scm: " + pom.scm?.connection) println("Scm: " + pom.scm?.connection)
println("Properties: " + pom.propertyValue("kotlin.version")) println("Properties: " + pom.propertyValue("kotlin.version"))
println("Plugin repositories: " + pom.pluginRepositories?.pluginRepository!![0])
} }
} }
class Properties { class Properties {
@XmlAnyElement @JvmField @XmlAnyElement @JvmField
var properties: ArrayList<Element>? = null val properties = arrayListOf<Element>()
} }
class Developers { class Developers {
@XmlElement(name = "developer") @JvmField @XmlElement(name = "developer") @JvmField
var developers: ArrayList<Developer>? = null val developers = arrayListOf<Developer>()
} }
class Developer { class Developer {
@ -70,7 +70,7 @@ class Developer {
class Licenses { class Licenses {
@XmlElement(name = "license") @JvmField @XmlElement(name = "license") @JvmField
var licenses : ArrayList<License>? = null val licenses = arrayListOf<License>()
} }
class License { class License {
@ -79,12 +79,22 @@ class License {
var distribution: String? = null var distribution: String? = null
} }
class PluginRepositories {
@XmlElement(name = "pluginRepository") @JvmField
val pluginRepository = arrayListOf<PluginRepository>()
}
class PluginRepository { class PluginRepository {
var id: String? = null var id: String? = null
var name: String? = null var name: String? = null
var url: String? = null var url: String? = null
} }
class Dependencies {
@XmlElement(name = "dependency") @JvmField
val dependencies = arrayListOf<Dependency>()
}
class Dependency { class Dependency {
var groupId: String? = null var groupId: String? = null
var artifactId: String? = null var artifactId: String? = null