Skip to content

Commit de17c4a

Browse files
committed
redo jooby-bom which now is auto-generated from parent pom
1 parent f478d51 commit de17c4a

9 files changed

Lines changed: 740 additions & 521 deletions

File tree

‎docs/pom.xml‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,4 @@
3838
</dependency>
3939
</dependencies>
4040

41-
<dependencyManagement>
42-
<dependencies>
43-
<dependency>
44-
<groupId>io.jooby</groupId>
45-
<artifactId>jooby-bom</artifactId>
46-
<version>${jooby.version}</version>
47-
<type>pom</type>
48-
<scope>import</scope>
49-
</dependency>
50-
</dependencies>
51-
</dependencyManagement>
52-
5341
</project>

‎examples/pom.xml‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,4 @@
5959
<artifactId>mysql-connector-java</artifactId>
6060
</dependency>
6161
</dependencies>
62-
63-
<dependencyManagement>
64-
<dependencies>
65-
<dependency>
66-
<groupId>io.jooby</groupId>
67-
<artifactId>jooby-bom</artifactId>
68-
<version>${jooby.version}</version>
69-
<type>pom</type>
70-
<scope>import</scope>
71-
</dependency>
72-
</dependencies>
73-
</dependencyManagement>
7462
</project>

‎jooby/pom.xml‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,4 @@
196196
</dependency>
197197
</dependencies>
198198

199-
<dependencyManagement>
200-
<dependencies>
201-
<dependency>
202-
<groupId>io.jooby</groupId>
203-
<artifactId>jooby-bom</artifactId>
204-
<version>${jooby.version}</version>
205-
<type>pom</type>
206-
<scope>import</scope>
207-
</dependency>
208-
</dependencies>
209-
</dependencyManagement>
210199
</project>

‎modules/jooby-bom/bom.groovy‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import groovy.xml.*
2+
import java.nio.file.*
3+
4+
def depsw = new StringWriter()
5+
def deps = new MarkupBuilder(depsw)
6+
7+
def propsw = new StringWriter()
8+
def props = new MarkupBuilder(propsw)
9+
10+
def propertyName(String groupId, String artifactId) {
11+
def names = [artifactId]
12+
names.addAll(artifactId.split('-'))
13+
names.addAll(groupId.split("\\.").reverse())
14+
15+
for (name in names) {
16+
def version = project.properties.get(name + '.version')
17+
if (version != null) {
18+
return '${' + name + '.version}'
19+
}
20+
}
21+
throw new IllegalArgumentException("Unable to find version for <" + groupId + ":" + artifactId + ">")
22+
}
23+
24+
deps.dependencyManagement {
25+
deps.dependencies {
26+
for (d in project.dependencyManagement.dependencies) {
27+
dependency {
28+
groupId(d.groupId)
29+
artifactId(d.artifactId)
30+
version(propertyName(d.groupId, d.artifactId))
31+
}
32+
}
33+
}
34+
}
35+
36+
props.properties {
37+
"jooby.version"(project.version)
38+
39+
for (p in project.properties.sort()) {
40+
if (p.key.endsWith("version")) {
41+
"${p.key}"("${p.value}")
42+
}
43+
}
44+
}
45+
46+
def template = new File("modules/jooby-bom/pom.template.xml").getText("UTF-8")
47+
48+
49+
def content = template.replace("@version", project.version)
50+
.replace("@dependencies", depsw.toString())
51+
.replace("@properties", propsw.toString())
52+
53+
def path = Paths.get("modules", "jooby-bom", "pom.xml")
54+
Files.createDirectories(path.getParent())
55+
Files.write(path, content.getBytes())

‎modules/jooby-bom/pom.template.xml‎

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns='http://maven.apache.org/POM/4.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
3+
xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd'>
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.jooby</groupId>
6+
<artifactId>jooby-bom</artifactId>
7+
<version>@version</version>
8+
<packaging>pom</packaging>
9+
<name>jooby-bom</name>
10+
<description>Jooby (Bill of Materials)</description>
11+
<url>https://github.com/jooby-project/jooby</url>
12+
13+
<!-- THIS FILE IS AUTO GENERATED. DON'T EDIT -->
14+
15+
@properties
16+
17+
@dependencies
18+
19+
<licenses>
20+
<license>
21+
<name>The Apache Software License, Version 2.0</name>
22+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
23+
</license>
24+
</licenses>
25+
<developers>
26+
<developer>
27+
<id>jknack</id>
28+
<name>Edgar Espina</name>
29+
<url>https://github.com/jknack</url>
30+
</developer>
31+
</developers>
32+
<scm>
33+
<connection>scm:git:git@github.com:jooby-project/jooby.git</connection>
34+
<developerConnection>scm:git:git@github.com:jooby-project/jooby.git</developerConnection>
35+
<url>scm:git:git@github.com:jooby-project/jooby.git</url>
36+
</scm>
37+
<distributionManagement>
38+
<repository>
39+
<id>ossrh</id>
40+
<name>Nexus Release Repository</name>
41+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
42+
</repository>
43+
</distributionManagement>
44+
45+
<profiles>
46+
<!-- Sonatype OSS release -->
47+
<profile>
48+
<id>sonatype-oss-release</id>
49+
<build>
50+
<plugins>
51+
<!-- Source -->
52+
<plugin>
53+
<groupId>org.apache.maven.plugins</groupId>
54+
<artifactId>maven-source-plugin</artifactId>
55+
<version>${maven-source-plugin.version}</version>
56+
<executions>
57+
<execution>
58+
<id>attach-sources</id>
59+
<goals>
60+
<goal>jar-no-fork</goal>
61+
</goals>
62+
</execution>
63+
</executions>
64+
</plugin>
65+
66+
<!-- Javadoc -->
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-javadoc-plugin</artifactId>
70+
<version>${maven-javadoc-plugin.version}</version>
71+
<executions>
72+
<execution>
73+
<id>attach-javadocs</id>
74+
<goals>
75+
<goal>jar</goal>
76+
</goals>
77+
</execution>
78+
</executions>
79+
</plugin>
80+
81+
<!-- GPG -->
82+
<plugin>
83+
<groupId>org.apache.maven.plugins</groupId>
84+
<artifactId>maven-gpg-plugin</artifactId>
85+
<version>${maven-gpg-plugin.version}</version>
86+
<executions>
87+
<execution>
88+
<id>sign-artifacts</id>
89+
<phase>verify</phase>
90+
<goals>
91+
<goal>sign</goal>
92+
</goals>
93+
</execution>
94+
</executions>
95+
</plugin>
96+
97+
<!-- Release plugin -->
98+
<plugin>
99+
<groupId>org.apache.maven.plugins</groupId>
100+
<artifactId>maven-release-plugin</artifactId>
101+
<version>${maven-release-plugin.version}</version>
102+
<configuration>
103+
<mavenExecutorId>forked-path</mavenExecutorId>
104+
<useReleaseProfile>false</useReleaseProfile>
105+
<arguments>-Psonatype-oss-release</arguments>
106+
<autoVersionSubmodules>true</autoVersionSubmodules>
107+
<tagNameFormat>v@{project.version}</tagNameFormat>
108+
<scmCommentPrefix>release</scmCommentPrefix>
109+
<goals>deploy</goals>
110+
</configuration>
111+
</plugin>
112+
113+
<plugin>
114+
<groupId>org.sonatype.plugins</groupId>
115+
<artifactId>nexus-staging-maven-plugin</artifactId>
116+
<version>${nexus-staging-maven-plugin.version}</version>
117+
<extensions>true</extensions>
118+
<configuration>
119+
<serverId>ossrh</serverId>
120+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
121+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
122+
</configuration>
123+
</plugin>
124+
</plugins>
125+
</build>
126+
</profile>
127+
</profiles>
128+
</project>

0 commit comments

Comments
 (0)