Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ollide committed Aug 21, 2023
2 parents 7bb7411 + 0326029 commit ead34a2
Show file tree
Hide file tree
Showing 40 changed files with 1,246 additions and 881 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ name: Java CI with Maven

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

Expand All @@ -16,9 +15,13 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 1.8
java-version-file: .java-version
distribution: 'temurin'
cache: 'maven'
- name: Print Maven version
run: mvn --version
- name: Build with Maven
run: mvn -B package --file pom.xml
run: mvn -B verify --file pom.xml -PintegrationTest
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11
523 changes: 84 additions & 439 deletions README.md

Large diffs are not rendered by default.

63 changes: 39 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.monday-consulting.maven.plugins</groupId>
<artifactId>fsm-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.8.2</version>
<version>2.0.0</version>
<name>fsm-maven-plugin</name>
<url>https://www.monday-consulting.com</url>

Expand Down Expand Up @@ -73,29 +73,29 @@
</licenses>

<prerequisites>
<maven>3.1.0</maven>
<maven>3.3.9</maven>
</prerequisites>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<compile.source.jdk>1.8</compile.source.jdk>
<compile.target.jdk>1.8</compile.target.jdk>
<compile.source.jdk>11</compile.source.jdk>
<compile.target.jdk>11</compile.target.jdk>

<mavenVersion>3.3.9</mavenVersion>
<eclipseAetherVersion>1.1.0</eclipseAetherVersion>

<junit.version>5.9.0</junit.version>

<maven.plugin.plugin>3.6.4</maven.plugin.plugin>
<maven.sonatype.nexus.plugin>1.6.13</maven.sonatype.nexus.plugin>
<maven.jaxb2.plugin>1.5</maven.jaxb2.plugin>
<maven.resources.plugin>3.3.0</maven.resources.plugin>
<maven.gpg.plugin>1.6</maven.gpg.plugin>
<maven.clean.plugin>3.2.0</maven.clean.plugin>
<maven.compiler.plugin>3.10.1</maven.compiler.plugin>
<maven.resources.plugin>3.3.1</maven.resources.plugin>
<maven.gpg.plugin>3.1.0</maven.gpg.plugin>
<maven.invoker.plugin>3.6.0</maven.invoker.plugin>
<maven.clean.plugin>3.3.1</maven.clean.plugin>
<maven.compiler.plugin>3.11.0</maven.compiler.plugin>
<maven.jar.plugin>3.3.0</maven.jar.plugin>
<maven.surefire.plugin>2.22.2</maven.surefire.plugin>
<maven.surefire.plugin>3.1.2</maven.surefire.plugin>
</properties>

<build>
Expand Down Expand Up @@ -204,6 +204,18 @@
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
Expand All @@ -221,19 +233,9 @@
<version>2.3.6</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-api</artifactId>
<version>${eclipseAetherVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-util</artifactId>
<version>${eclipseAetherVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-impl</artifactId>
<version>${eclipseAetherVersion}</version>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-artifact-transfer</artifactId>
<version>0.13.1</version>
</dependency>
<dependency>
<groupId>net.lingala.zip4j</groupId>
Expand All @@ -253,6 +255,12 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.5.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
Expand Down Expand Up @@ -305,7 +313,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.3.0</version>
<version>${maven.invoker.plugin}</version>
<configuration>
<projectsDirectory>src/it</projectsDirectory>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
Expand All @@ -316,6 +324,13 @@
<mavenExecutable>${maven.home}/bin/mvnDebug</mavenExecutable>
-->
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-xml</artifactId>
<version>4.0.13</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>integration-test</phase>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import groovy.xml.XmlSlurper

def moduleXmlFile = new File(basedir, 'target/extra-resources/module.xml')
assert moduleXmlFile.exists() : "The module.xml descriptor was not created.";
assert moduleXmlFile.exists() : "The module.xml descriptor was not created"
def doc = new XmlSlurper().parse(moduleXmlFile)
assert doc.version == "15.5.0" : "The module.xml version was not filtered."
assert doc.version == "15.5.0" : "The module.xml version was not filtered"

// Verify resolved versions for guava

Expand All @@ -12,16 +14,16 @@ static def getResource(doc, mode, scope, name) {
}
}

static def verifyResource(doc, mode, scope, version) {
static def verifyResource(doc, mode, scope, versionPattern) {
def guava = "com.google.guava:guava"

def resource = getResource(doc, mode, scope, guava)
def resourceSize = resource.size()
assert resourceSize == 1
def resourceVersion = resource.get(0).attributes().version
assert resourceVersion == version : "Guava version for " + mode + "-" + scope + " must be " + version
assert resourceVersion ==~ versionPattern: "Guava version for " + mode + "-" + scope + " must match " + versionPattern
}

verifyResource(doc, "isolated", "module", "27.1-jre")
verifyResource(doc, "isolated", "server", "19.0.20150826")
verifyResource(doc, "legacy", "server", "31.1-jre")
verifyResource(doc, "isolated", "module", /27.1-jre/)
verifyResource(doc, "isolated", "server", /19.0.*/)
verifyResource(doc, "legacy", "server", /31.1-jre/)
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import groovy.xml.XmlSlurper

def moduleXmlFile = new File(basedir, 'target/extra-resources/module.xml')
assert moduleXmlFile.exists() : "The module.xml descriptor was not created.";
assert moduleXmlFile.exists() : "The module.xml descriptor was not created"
def doc = new XmlSlurper().parse(moduleXmlFile)
assert doc.version == 11 : "The module.xml version was not filtered."
assert doc.version == 11 : "The module.xml version was not filtered"

// verify commons-math3 is under <components> -> <web-app> -> <web-resources> and has the correct version

Expand Down
12 changes: 12 additions & 0 deletions src/it/prepare-dependency-with-classifier/fsm/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<fsm-maven-plugin>
<modules>
<module>
<!-- use dependencies from this Maven project (../pom.xml) -->
<id>${project.groupId}:${project.artifactId}:${project.version}</id>

<!-- This matches the tag in prototype.module.xml -->
<dependencyTagValueInXml>xmlresolver</dependencyTagValueInXml>
</module>
</modules>
</fsm-maven-plugin>
16 changes: 16 additions & 0 deletions src/it/prepare-dependency-with-classifier/fsm/prototype.module.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<module>

<name>Monday XML Resovler</name>
<version>${project.version}</version>

<components>
<web-app>
<name>XML Resolver</name>
<version>${project.version}</version>
<web-resources>
<!-- Tag from plugin.xml -->
<dependencies>xmlresolver</dependencies>
</web-resources>
</web-app>
</components>
</module>
82 changes: 82 additions & 0 deletions src/it/prepare-dependency-with-classifier/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.monday-consulting.maven.plugins</groupId>
<artifactId>dependency-with-classifier</artifactId>
<version>11</version>
<packaging>pom</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<xmlresolver.version>5.2.0</xmlresolver.version>
</properties>

<dependencies>
<dependency>
<groupId>org.xmlresolver</groupId>
<artifactId>xmlresolver</artifactId>
<version>${xmlresolver.version}</version>
</dependency>
<dependency>
<groupId>org.xmlresolver</groupId>
<artifactId>xmlresolver</artifactId>
<classifier>data</classifier>
<version>${xmlresolver.version}</version>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>fsm</directory>
<filtering>true</filtering>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/extra-resources</outputDirectory>
<resources>
<resource>
<directory>fsm</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.monday-consulting.maven.plugins</groupId>
<artifactId>fsm-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<configXml>${basedir}/target/extra-resources/plugin.xml</configXml>
<prototypeXml>${basedir}/target/extra-resources/prototype.module.xml</prototypeXml>
</configuration>
<executions>
<execution>
<id>prepare-module</id>
<phase>package</phase>
<goals>
<goal>prepare</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
24 changes: 24 additions & 0 deletions src/it/prepare-dependency-with-classifier/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import groovy.xml.XmlSlurper

def fsmDir = new File(basedir, 'target/fsm-root')
assert fsmDir.exists() : "The FSM root directory was not created"

def moduleXmlFile = new File(fsmDir, 'META-INF/module.xml')
assert moduleXmlFile.exists() : "The module.xml descriptor was not created"
def moduleIsolatedXmlFile = new File(fsmDir, 'META-INF/module-isolated.xml')
assert moduleIsolatedXmlFile.exists() : "The module-isolated.xml descriptor was not created"

def doc = new XmlSlurper().parse(moduleXmlFile)
assert doc.version == 11 : "The module.xml version was not filtered"

// verify commons-math3 is under <components> -> <web-app> -> <web-resources> and has the correct version
def resource = doc.components.'web-app'.'web-resources'.childNodes().find { it.attributes().name = "org.xmlresolver:xmlresolver" }
assert resource != null : "org.xmlresolver:xmlresolver (no classifier) resource must exist in module.xml"
def resourceWithClassifier = doc.components.'web-app'.'web-resources'.childNodes().find { it.attributes().name = "org.xmlresolver:xmlresolver:data" }
assert resourceWithClassifier != null : "org.xmlresolver:xmlresolver:data (with classifier) resource must exist in module.xml"

// verify dependency has been copied to <fsm-root>/lib/
def libDir = new File(fsmDir, 'lib');
assert libDir.exists() : "The lib directory was not created"
assert (new File(libDir, 'xmlresolver-5.2.0.jar').exists()) : "The resource lib 'xmlresolver-5.2.0.jar' was not copied to the lib/ directory"
assert (new File(libDir, 'xmlresolver-5.2.0-data.jar').exists()) : "The resource lib 'xmlresolver-5.2.0.jar-data' was not copied to the lib/ directory"
18 changes: 18 additions & 0 deletions src/it/prepare-example/fsm-assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>fsm</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>

<fileSets>
<fileSet>
<directory>${basedir}/target/fsm-root</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>

</assembly>
10 changes: 10 additions & 0 deletions src/it/prepare-example/fsm/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<fsm-maven-plugin>
<modules>
<module>
<id>org.apache.commons:commons-math3:jar:${commons.math.version}</id>
<!-- This matches the tag in prototype.module.xml -->
<dependencyTagValueInXml>math</dependencyTagValueInXml>
</module>
</modules>
</fsm-maven-plugin>
16 changes: 16 additions & 0 deletions src/it/prepare-example/fsm/prototype.module.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<module>

<name>Monday Math</name>
<version>${project.version}</version>

<components>
<web-app>
<name>Math</name>
<version>${project.version}</version>
<web-resources>
<!-- Tag from plugin.xml -->
<dependencies>math</dependencies>
</web-resources>
</web-app>
</components>
</module>
Loading

0 comments on commit ead34a2

Please sign in to comment.