Skip to content

Commit 196a0e9

Browse files
BananeweizenCalixte
authored andcommitted
upgrade external target platform dependencies
Simplify looking for target platform upgrades by injecting them into the Maven object model and let Maven check for available upgrades. That's why this project now has a pom.xml, but is NOT part of the modules list of the parent.
1 parent 006d669 commit 196a0e9

File tree

5 files changed

+112
-8
lines changed

5 files changed

+112
-8
lines changed

net.sf.eclipsecs.target/Maven update check.launch renamed to net.sf.eclipsecs.target/Maven target update check.launch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
33
<intAttribute key="M2_COLORS" value="0"/>
44
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
5-
<stringAttribute key="M2_GOALS" value="versions:display-dependency-updates versions:display-plugin-updates -T1"/>
5+
<stringAttribute key="M2_GOALS" value="verify -T1"/>
66
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
77
<booleanAttribute key="M2_OFFLINE" value="false"/>
8-
<stringAttribute key="M2_PROFILES" value=""/>
8+
<stringAttribute key="M2_PROFILES" value="update-check-for-target-maven-artifacts"/>
99
<listAttribute key="M2_PROPERTIES"/>
1010
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
1111
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
@@ -21,5 +21,5 @@
2121
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
2222
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
2323
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
24-
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${git_work_tree:/eclipse-cs}"/>
24+
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/net.sf.eclipsecs.target}"/>
2525
</launchConfiguration>

net.sf.eclipsecs.target/net.sf.eclipsecs.target.target

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<?pde?>
33
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
4-
<target name="Eclipse Checkstyle" sequenceNumber="1711962228">
4+
<target name="Eclipse Checkstyle" sequenceNumber="1717393787">
55
<locations>
66
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
77
<unit id="org.eclipse.jdt.feature.group" version="3.18.1300.v20220831-1800"/>
@@ -75,7 +75,7 @@
7575
<dependency>
7676
<groupId>io.github.classgraph</groupId>
7777
<artifactId>classgraph</artifactId>
78-
<version>4.8.168</version>
78+
<version>4.8.172</version>
7979
<type>jar</type>
8080
</dependency>
8181
</dependencies>
@@ -85,7 +85,7 @@
8585
<dependency>
8686
<groupId>org.assertj</groupId>
8787
<artifactId>assertj-core</artifactId>
88-
<version>3.25.1</version>
88+
<version>3.26.0</version>
8989
<type>jar</type>
9090
</dependency>
9191
</dependencies>

net.sf.eclipsecs.target/net.sf.eclipsecs.target.tpd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ maven AssertJ
7373
dependency {
7474
groupId="org.assertj"
7575
artifactId="assertj-core"
76-
version="3.25.1"
76+
version="3.26.0"
7777
}
7878
}
7979
maven Classgraph
@@ -85,7 +85,7 @@ maven Classgraph
8585
dependency {
8686
groupId="io.github.classgraph"
8787
artifactId="classgraph"
88-
version="4.8.168"
88+
version="4.8.172"
8989
}
9090
}
9191
maven DOM4J

net.sf.eclipsecs.target/pom.xml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<artifactId>net.sf.eclipsecs.parent</artifactId>
6+
<groupId>net.sf.eclipsecs</groupId>
7+
<version>10.14.2-SNAPSHOT</version>
8+
</parent>
9+
<artifactId>net.sf.eclipsecs.target</artifactId>
10+
<packaging>pom</packaging>
11+
12+
<profiles>
13+
<profile>
14+
<id>update-check-for-target-maven-artifacts</id>
15+
<activation>
16+
<activeByDefault>false</activeByDefault>
17+
</activation>
18+
<build>
19+
<plugins>
20+
<!-- scan target files and add maven artifacts as dependencies to this pom -->
21+
<plugin>
22+
<groupId>org.codehaus.gmaven</groupId>
23+
<artifactId>groovy-maven-plugin</artifactId>
24+
<version>2.1.1</version>
25+
<executions>
26+
<execution>
27+
<id>add-dependencies-from-m2e-target</id>
28+
<phase>initialize</phase>
29+
<goals>
30+
<goal>execute</goal>
31+
</goals>
32+
<configuration>
33+
<source>${project.basedir}/target_platform_maven_updates.groovy</source>
34+
</configuration>
35+
</execution>
36+
</executions>
37+
</plugin>
38+
<!-- this execution should be in a later phase than the groovy execution which adds artificial dependencies -->
39+
<plugin>
40+
<groupId>org.codehaus.mojo</groupId>
41+
<artifactId>versions-maven-plugin</artifactId>
42+
<executions>
43+
<execution>
44+
<id>dependency-updates</id>
45+
<goals>
46+
<goal>display-dependency-updates</goal>
47+
</goals>
48+
<phase>generate-resources</phase>
49+
</execution>
50+
</executions>
51+
</plugin>
52+
<plugin>
53+
<artifactId>maven-checkstyle-plugin</artifactId>
54+
<executions>
55+
<execution>
56+
<id>checkstyle-check</id>
57+
<phase>none</phase>
58+
</execution>
59+
<execution>
60+
<id>sevntu-checkstyle-check</id>
61+
<phase>none</phase>
62+
</execution>
63+
</executions>
64+
</plugin>
65+
</plugins>
66+
</build>
67+
</profile>
68+
</profiles>
69+
70+
</project>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* This is a script to check for updates of the Maven artifacts in target files.
3+
* When executed with the maven-groovy plugin, it will inject all target platform dependencies into the Maven model.
4+
* Invoking versions-maven-plugin:display-dependency-updates immediately afterwards then shows the available updates.
5+
*/
6+
import org.apache.maven.model.Dependency
7+
8+
import java.util.regex.Matcher;
9+
import java.util.regex.Pattern;
10+
11+
def files = basedir.listFiles()
12+
for (File file : files) {
13+
if (file.getName().endsWith('.target')) {
14+
log.info('analyzing target {}', file.getName())
15+
String targetContent = file.getText('UTF-8')
16+
Pattern pattern = Pattern.compile('<groupId>(.+?)</groupId>\\s*<artifactId>(.+?)</artifactId>\\s*<version>(.+?)</version>', Pattern.DOTALL)
17+
Matcher matcher = pattern.matcher(targetContent)
18+
19+
while (matcher.find()) {
20+
String groupId = matcher.group(1)
21+
String artifactId = matcher.group(2)
22+
String version = matcher.group(3)
23+
log.info('adding m2e target dependency {}:{}:{}', groupId, artifactId, version)
24+
25+
def dependency = new Dependency()
26+
dependency.setGroupId(groupId)
27+
dependency.setArtifactId(artifactId)
28+
dependency.setVersion(version)
29+
dependency.setScope("compile")
30+
31+
project.getDependencies().add(dependency)
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)