Skip to content

Commit 0c1a562

Browse files
authored
Update build, get rid of legacy, fix CLI (#452)
Port 90352d3 to this PR, CLI use nop logging, rest unchanged. Fixes #434
1 parent 0db6ec9 commit 0c1a562

File tree

5 files changed

+120
-50
lines changed

5 files changed

+120
-50
lines changed

modello-core/pom.xml

Lines changed: 63 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,89 @@
1919
<dependency>
2020
<groupId>org.eclipse.sisu</groupId>
2121
<artifactId>org.eclipse.sisu.plexus</artifactId>
22-
<scope>provided</scope>
22+
<exclusions>
23+
<exclusion>
24+
<groupId>javax.annotation</groupId>
25+
<artifactId>javax.annotation-api</artifactId>
26+
</exclusion>
27+
<exclusion>
28+
<groupId>javax.enterprise</groupId>
29+
<artifactId>cdi-api</artifactId>
30+
</exclusion>
31+
</exclusions>
2332
</dependency>
2433
<dependency>
25-
<groupId>org.sonatype.sisu</groupId>
26-
<artifactId>sisu-guice</artifactId>
27-
<classifier>no_aop</classifier>
34+
<groupId>com.google.inject</groupId>
35+
<artifactId>guice</artifactId>
2836
<scope>runtime</scope>
2937
</dependency>
3038
<dependency>
3139
<groupId>org.codehaus.plexus</groupId>
3240
<artifactId>plexus-utils</artifactId>
3341
</dependency>
34-
<dependency>
35-
<groupId>org.codehaus.plexus</groupId>
36-
<artifactId>plexus-xml</artifactId>
37-
</dependency>
3842
<dependency>
3943
<groupId>org.slf4j</groupId>
4044
<artifactId>slf4j-api</artifactId>
4145
</dependency>
4246
<dependency>
4347
<groupId>org.slf4j</groupId>
44-
<artifactId>slf4j-simple</artifactId>
45-
<scope>test</scope>
48+
<artifactId>slf4j-nop</artifactId>
49+
<scope>runtime</scope>
50+
<optional>true</optional>
4651
</dependency>
4752
</dependencies>
4853

4954
<build>
5055
<plugins>
5156
<plugin>
52-
<artifactId>maven-assembly-plugin</artifactId>
53-
<configuration>
54-
<descriptorRefs>
55-
<descriptorRef>jar-with-dependencies</descriptorRef>
56-
</descriptorRefs>
57-
<archive>
58-
<manifest>
59-
<mainClass>org.codehaus.modello.ModelloCli</mainClass>
60-
</manifest>
61-
</archive>
62-
</configuration>
57+
<groupId>org.apache.maven.plugins</groupId>
58+
<artifactId>maven-shade-plugin</artifactId>
59+
<version>3.5.3</version>
60+
<executions>
61+
<execution>
62+
<id>cli</id>
63+
<goals>
64+
<goal>shade</goal>
65+
</goals>
66+
<phase>package</phase>
67+
<configuration>
68+
<shadedClassifierName>cli</shadedClassifierName>
69+
<createDependencyReducedPom>false</createDependencyReducedPom>
70+
<shadedArtifactAttached>true</shadedArtifactAttached>
71+
<transformers>
72+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
73+
<transformer implementation="org.apache.maven.plugins.shade.resource.SisuIndexResourceTransformer" />
74+
<transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer" />
75+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
76+
<manifestEntries>
77+
<Main-Class>org.codehaus.modello.ModelloCli</Main-Class>
78+
<Specification-Title>${project.artifactId}</Specification-Title>
79+
<Specification-Version>${project.version}</Specification-Version>
80+
<Implementation-Title>${project.artifactId}</Implementation-Title>
81+
<Implementation-Version>${project.version}</Implementation-Version>
82+
<Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
83+
</manifestEntries>
84+
</transformer>
85+
</transformers>
86+
<filters>
87+
<filter>
88+
<artifact>*:*</artifact>
89+
<excludes>
90+
<exclude>META-INF/MANIFEST.MF</exclude>
91+
<exclude>META-INF/LICENSE</exclude>
92+
<exclude>META-INF/LICENSE.txt</exclude>
93+
<exclude>META-INF/DEPENDENCIES</exclude>
94+
<exclude>META-INF/NOTICE</exclude>
95+
<exclude>META-INF/NOTICE.txt</exclude>
96+
<exclude>**/module-info.class</exclude>
97+
<exclude>about.html</exclude>
98+
<exclude>overview.html</exclude>
99+
</excludes>
100+
</filter>
101+
</filters>
102+
</configuration>
103+
</execution>
104+
</executions>
63105
</plugin>
64106
</plugins>
65107
</build>

modello-core/src/main/java/org/codehaus/modello/Modello.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@
2222
* SOFTWARE.
2323
*/
2424

25-
import javax.inject.Inject;
26-
2725
import java.io.Reader;
2826
import java.io.Writer;
2927
import java.util.Map;
3028

3129
import org.codehaus.modello.core.ModelloCore;
3230
import org.codehaus.modello.model.Model;
3331
import org.codehaus.modello.model.ModelValidationException;
32+
import org.codehaus.plexus.DefaultContainerConfiguration;
33+
import org.codehaus.plexus.DefaultPlexusContainer;
34+
import org.codehaus.plexus.PlexusConstants;
3435

3536
/**
3637
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
@@ -39,9 +40,15 @@
3940
public class Modello {
4041
private final ModelloCore core;
4142

42-
@Inject
43-
public Modello(ModelloCore core) {
44-
this.core = core;
43+
public Modello() throws ModelloException {
44+
try {
45+
this.core = new DefaultPlexusContainer(new DefaultContainerConfiguration()
46+
.setClassPathScanning(PlexusConstants.SCANNING_INDEX)
47+
.setAutoWiring(true))
48+
.lookup(ModelloCore.class);
49+
} catch (Exception e) {
50+
throw new ModelloException("Error while starting plexus.", e);
51+
}
4552
}
4653

4754
public void generate(Reader modelReader, String outputType, Map<String, Object> parameters)

modello-core/src/main/java/org/codehaus/modello/ModelloCli.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.util.HashMap;
2727
import java.util.Map;
2828

29-
import org.codehaus.plexus.DefaultPlexusContainer;
3029
import org.codehaus.plexus.util.StringUtils;
3130
import org.codehaus.plexus.util.xml.XmlStreamReader;
3231

@@ -41,7 +40,7 @@ public class ModelloCli {
4140
private static Map<String, Object> parameters;
4241

4342
public static void main(String[] args) throws Exception {
44-
Modello modello = new DefaultPlexusContainer().lookup(Modello.class);
43+
Modello modello = new Modello();
4544

4645
parseArgumentsFromCommandLine(args);
4746

modello-maven-plugin/pom.xml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,35 @@
1919
</prerequisites>
2020

2121
<dependencies>
22+
<dependency>
23+
<groupId>org.codehaus.modello</groupId>
24+
<artifactId>modello-core</artifactId>
25+
<exclusions>
26+
<exclusion>
27+
<groupId>org.eclipse.sisu</groupId>
28+
<artifactId>org.eclipse.sisu.plexus</artifactId>
29+
</exclusion>
30+
<exclusion>
31+
<groupId>com.google.inject</groupId>
32+
<artifactId>guice</artifactId>
33+
</exclusion>
34+
</exclusions>
35+
</dependency>
36+
<dependency>
37+
<groupId>org.codehaus.plexus</groupId>
38+
<artifactId>plexus-utils</artifactId>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.codehaus.plexus</groupId>
42+
<artifactId>plexus-build-api</artifactId>
43+
</dependency>
44+
2245
<dependency>
2346
<groupId>org.apache.maven</groupId>
2447
<artifactId>maven-plugin-api</artifactId>
2548
<version>${mavenVersion}</version>
2649
<scope>provided</scope>
2750
</dependency>
28-
<dependency>
29-
<groupId>org.codehaus.modello</groupId>
30-
<artifactId>modello-core</artifactId>
31-
</dependency>
3251
<dependency>
3352
<groupId>org.apache.maven</groupId>
3453
<artifactId>maven-model</artifactId>
@@ -41,10 +60,6 @@
4160
<version>${mavenVersion}</version>
4261
<scope>provided</scope>
4362
</dependency>
44-
<dependency>
45-
<groupId>org.codehaus.plexus</groupId>
46-
<artifactId>plexus-utils</artifactId>
47-
</dependency>
4863
<dependency>
4964
<groupId>org.apache.maven.plugin-tools</groupId>
5065
<artifactId>maven-plugin-annotations</artifactId>
@@ -70,6 +85,7 @@
7085
<dependency>
7186
<groupId>org.codehaus.modello</groupId>
7287
<artifactId>modello-plugin-java</artifactId>
88+
<scope>runtime</scope>
7389
</dependency>
7490
<dependency>
7591
<groupId>org.codehaus.modello</groupId>
@@ -114,11 +130,9 @@
114130
<dependency>
115131
<groupId>org.codehaus.modello</groupId>
116132
<artifactId>modello-plugin-velocity</artifactId>
133+
<!-- Directly used -->
117134
</dependency>
118-
<dependency>
119-
<groupId>org.codehaus.plexus</groupId>
120-
<artifactId>plexus-build-api</artifactId>
121-
</dependency>
135+
122136
<dependency>
123137
<groupId>org.slf4j</groupId>
124138
<artifactId>slf4j-simple</artifactId>

pom.xml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@
194194
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
195195
<jackson.version>2.17.1</jackson.version>
196196
<jdom.version>2.0.2</jdom.version>
197-
<mavenVersion>3.5.4</mavenVersion>
197+
<slf4j.version>1.7.36</slf4j.version>
198+
<mavenVersion>3.6.3</mavenVersion>
198199
<!--
199200
! This controls the minimum java version
200201
! and also the version which is used
@@ -297,18 +298,17 @@
297298
<dependency>
298299
<groupId>org.eclipse.sisu</groupId>
299300
<artifactId>org.eclipse.sisu.plexus</artifactId>
300-
<version>0.3.5</version>
301+
<version>0.9.0.M2</version>
301302
</dependency>
302303
<dependency>
303-
<groupId>org.sonatype.sisu</groupId>
304-
<artifactId>sisu-guice</artifactId>
305-
<version>4.2.0</version>
306-
<classifier>no_aop</classifier>
304+
<groupId>com.google.inject</groupId>
305+
<artifactId>guice</artifactId>
306+
<version>5.1.0</version>
307307
</dependency>
308308
<dependency>
309309
<groupId>org.codehaus.plexus</groupId>
310310
<artifactId>plexus-utils</artifactId>
311-
<version>4.0.1</version>
311+
<version>3.5.1</version>
312312
</dependency>
313313
<dependency>
314314
<groupId>org.codehaus.plexus</groupId>
@@ -323,12 +323,17 @@
323323
<dependency>
324324
<groupId>org.slf4j</groupId>
325325
<artifactId>slf4j-api</artifactId>
326-
<version>1.7.36</version>
326+
<version>${slf4j.version}</version>
327+
</dependency>
328+
<dependency>
329+
<groupId>org.slf4j</groupId>
330+
<artifactId>slf4j-nop</artifactId>
331+
<version>${slf4j.version}</version>
327332
</dependency>
328333
<dependency>
329334
<groupId>org.slf4j</groupId>
330335
<artifactId>slf4j-simple</artifactId>
331-
<version>1.7.36</version>
336+
<version>${slf4j.version}</version>
332337
</dependency>
333338
<dependency>
334339
<groupId>junit</groupId>
@@ -369,6 +374,9 @@
369374
</goals>
370375
<configuration>
371376
<rules>
377+
<requireMavenVersion>
378+
<version>${mavenVersion}</version>
379+
</requireMavenVersion>
372380
<requireJavaVersion>
373381
<version>${javaVersion}</version>
374382
</requireJavaVersion>
@@ -438,7 +446,7 @@
438446
<plugin>
439447
<groupId>org.codehaus.modello</groupId>
440448
<artifactId>modello-maven-plugin</artifactId>
441-
<version>2.0.0</version>
449+
<version>2.4.0</version>
442450
<configuration>
443451
<models>
444452
<model>src/main/mdo/modello.mdo</model>

0 commit comments

Comments
 (0)