Skip to content

Commit d3a713b

Browse files
committed
jooby should probably have a bom (bill of materials) pom. fix #363
1 parent fa23fa4 commit d3a713b

2 files changed

Lines changed: 438 additions & 0 deletions

File tree

jooby-bom/bom.groovy

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env groovy
2+
// usage: groovy bom.groovy ../pom.xml > pom.xml
3+
import groovy.xml.*
4+
5+
def xml = new XmlSlurper().parse(new File(args[0]));
6+
def sw = new StringWriter()
7+
def b = new MarkupBuilder(sw)
8+
9+
def i = 0;
10+
11+
b.print('<?xml version="1.0" encoding="UTF-8"?>\n')
12+
13+
b.project("xmlns": "http://maven.apache.org/POM/4.0.0", 'xmlns:xsi': "http://www.w3.org/2001/XMLSchema-instance", 'xsi:schemaLocation': "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd") {
14+
15+
b.modelVersion('4.0.0')
16+
b.groupId(xml.groupId)
17+
b.artifactId('jooby-bom')
18+
b.version(xml.version)
19+
b.packaging(xml.packaging)
20+
b.name('jooby-bom')
21+
b.description('Jooby (Bill of Materials)')
22+
b.url(xml.url)
23+
24+
b.properties {
25+
'jooby.version'(xml.version)
26+
}
27+
28+
b.licenses {
29+
for (l in xml.licenses.license) {
30+
license {
31+
name(l.name)
32+
url(l.url)
33+
}
34+
}
35+
}
36+
37+
b.developers {
38+
for (d in xml.developers.developer) {
39+
developer {
40+
id(d.id)
41+
name(d.name)
42+
url(d.url)
43+
}
44+
}
45+
}
46+
47+
b.scm {
48+
connection(xml.scm.connection)
49+
developerConnection(xml.scm.developerConnection)
50+
url(xml.scm.url)
51+
}
52+
53+
b.distributionManagement {
54+
repository {
55+
id(xml.distributionManagement.repository.id)
56+
name(xml.distributionManagement.repository.name)
57+
url(xml.distributionManagement.repository.url)
58+
}
59+
}
60+
61+
b.dependencyManagement {
62+
dependencies {
63+
for (m in xml.modules.module) {
64+
if (m.text().endsWith('-bom') || m.text().contains('coverage-report')) continue;
65+
dependency {
66+
groupId('${project.groupId}');
67+
artifactId(m.text());
68+
version('${jooby.version}');
69+
}
70+
}
71+
}
72+
}
73+
}
74+
75+
println sw;

0 commit comments

Comments
 (0)