Im building an application that reads parses code from thats input from a front end written in JavaFX, which forces me to make the whole project modular. Unfortunately antlr doesnt seem to support this yet and I get the following error when compiling: Plugin org.antlr:antlr4-maven-plugin:4.10.2 or one of its dependencies could not be resolved
Im using different modules, with a main pom and one for each module
here's the main pom:
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>nl.han.aim.asd.game</groupId>
<artifactId>chips-distribution-game-parent</artifactId>
<packaging>pom</packaging>
<version>0.0.1</version>
<name>The Chips Distribution Game</name>
<description>Een management spel om inzicht te geven in de dynamiek van een logistieke distributieketen
</description>
<modules>
<module>game-logic</module>
<module>persistence</module>
<module>agent</module>
<module>network</module>
<module>game-manager</module>
<module>user-interface</module>
<module>shared-dtos</module>
<module>jacoco-aggregator</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sonar.coverage.jacoco.xmlReportPaths>
${project.basedir}/../jacoco-aggregator/target/site/jacoco-aggregate/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
<sonar.junit.reportPaths>target/surefire-reports</sonar.junit.reportPaths>
<sonar.coverage.exclusions>
agent/src/main/java/nl/han/aim/asd/game/agent/App.java,
game-logic/src/main/java/nl/han/aim/asd/game/gamelogic/App.java,
game-manager/src/main/java/nl/han/aim/asd/game/gamemanager/App.java,
network/src/main/java/nl/han/aim/asd/game/network/App.java,
persistence/src/main/java/nl/han/aim/asd/game/persistence/App.java,
shared-dtos/src/main/java/nl/han/aim/asd/game/shareddtos/**,
user-interface/src/main/java/nl/han/aim/asd/game/userinterface/**
</sonar.coverage.exclusions>
<skipTests>false</skipTests>
<skipUnitTests>${skipTests}</skipUnitTests>
<skipIntegrationTests>${skipTests}</skipIntegrationTests>
</properties>
<repositories>
<repository>
<id>gitlab-maven</id>
<url>http://gitlab.devops.aimsites.nl/api/v4/projects/148/packages/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>gitlab-maven</id>
<url>http://gitlab.devops.aimsites.nl/api/v4/projects/148/packages/maven</url>
</repository>
<snapshotRepository>
<id>gitlab-maven</id>
<url>http://gitlab.devops.aimsites.nl/api/v4/projects/148/packages/maven</url>
</snapshotRepository>
</distributionManagement>
<profiles>
<!-- We need a constant finalName for use in the Dockerfile -->
<profile>
<id>shade</id>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>shade</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<version>5.0.0.CR2</version>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-junit5</artifactId>
<version>4.0.0.CR1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>4.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>3.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>shade</id>
<!-- Only needed for manual integration testing -->
<phase>none</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M6</version>
<configuration>
<skipTests>${skipUnitTests}</skipTests>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M6</version>
<configuration>
<skipTests>${skipIntegrationTests}</skipTests>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
<violationSeverity>warning</violationSeverity>
<sourceDirectories>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
<sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
</sourceDirectories>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.1</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>CLASS</element>
<limits>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>0.8</minimum>
</limit>
<limit>
<counter>CLASS</counter>
<value>MISSEDCOUNT</value>
<maximum>0</maximum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.9.1.2184</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.11.0</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<reportSets>
<reportSet>
<reports>
<report>aggregate</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>
and here's the pom for the module that fails on compilation
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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>
<parent>
<artifactId>chips-distribution-game-parent</artifactId>
<groupId>nl.han.aim.asd.game</groupId>
<version>0.0.1</version>
</parent>
<artifactId>agent</artifactId>
<version>0.0.1</version>
<name>chips-distribution-game-agent-component</name>
<repositories>
<repository>
<id>gitlab-maven-antlr4</id>
<url>http://gitlab.devops.aimsites.nl/api/v4/projects/152/packages/maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>gitlab-maven-antlr4</id>
<url>http://gitlab.devops.aimsites.nl/api/v4/projects/152/packages/maven</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.10.2</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>nl.han.aim.asd.game</groupId>
<artifactId>persistence</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>nl.han.aim.asd.game</groupId>
<artifactId>shared-dtos</artifactId>
<version>0.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.10.2</version>
<executions>
<execution>
<id>antlr</id>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>check</id>
<configuration>
<rules>
<rule>
<excludes>
<exclude>nl.han.aim.asd.game.agent.App</exclude>
<exclude>nl.han.aim.asd.game.agent.parser.AgentParser</exclude>
<exclude>nl.han.aim.asd.game.agent.parser.AgentParser.*</exclude>
<exclude>nl.han.aim.asd.game.agent.ast.*</exclude>
<exclude>nl.han.aim.asd.game.agent.demo.*</exclude>
<exclude>nl.han.aim.asd.game.agent.datastructures.*</exclude>
</excludes>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>shade</id>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>nl.han.aim.asd.game.agent.App</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
and here is the module-info for the failing component
module nl.han.aim.asd.game.agent {
requires org.antlr.antlr4.runtime;
requires nl.han.aim.asd.game.persistence;
requires nl.han.aim.asd.game.shareddtos;
exports nl.han.aim.asd.game.agent;
}
CodePudding user response:
AFAIK, there is no 4.10.2 version (at this time), try 4.10.1 instead.
EDIT
I tried with the following (I commented out some dependencies, but left the ANTLR dependencies):
parent
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>nl.han.aim.asd.game</groupId>
<artifactId>chips-distribution-game-parent</artifactId>
<packaging>pom</packaging>
<version>0.0.1</version>
<name>The Chips Distribution Game</name>
<description>Een management spel om inzicht te geven in de dynamiek van een logistieke distributieketen
</description>
<modules>
<module>game-logic</module>
<module>persistence</module>
<module>agent</module>
<module>network</module>
<module>game-manager</module>
<module>user-interface</module>
<module>shared-dtos</module>
<module>jacoco-aggregator</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sonar.coverage.jacoco.xmlReportPaths>
${project.basedir}/../jacoco-aggregator/target/site/jacoco-aggregate/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
<sonar.junit.reportPaths>target/surefire-reports</sonar.junit.reportPaths>
<sonar.coverage.exclusions>
agent/src/main/java/nl/han/aim/asd/game/agent/App.java,
game-logic/src/main/java/nl/han/aim/asd/game/gamelogic/App.java,
game-manager/src/main/java/nl/han/aim/asd/game/gamemanager/App.java,
network/src/main/java/nl/han/aim/asd/game/network/App.java,
persistence/src/main/java/nl/han/aim/asd/game/persistence/App.java,
shared-dtos/src/main/java/nl/han/aim/asd/game/shareddtos/**,
user-interface/src/main/java/nl/han/aim/asd/game/userinterface/**
</sonar.coverage.exclusions>
<skipTests>false</skipTests>
<skipUnitTests>${skipTests}</skipUnitTests>
<skipIntegrationTests>${skipTests}</skipIntegrationTests>
</properties>
<repositories>
<repository>
<id>gitlab-maven</id>
<url>http://gitlab.devops.aimsites.nl/api/v4/projects/148/packages/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>gitlab-maven</id>
<url>http://gitlab.devops.aimsites.nl/api/v4/projects/148/packages/maven</url>
</repository>
<snapshotRepository>
<id>gitlab-maven</id>
<url>http://gitlab.devops.aimsites.nl/api/v4/projects/148/packages/maven</url>
</snapshotRepository>
</distributionManagement>
<profiles>
<!-- We need a constant finalName for use in the Dockerfile -->
<profile>
<id>shade</id>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>shade</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<version>5.0.0.CR2</version>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-junit5</artifactId>
<version>4.0.0.CR1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>4.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>3.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>shade</id>
<!-- Only needed for manual integration testing -->
<phase>none</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M6</version>
<configuration>
<skipTests>${skipUnitTests}</skipTests>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M6</version>
<configuration>
<skipTests>${skipIntegrationTests}</skipTests>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!--
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
<violationSeverity>warning</violationSeverity>
<sourceDirectories>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
<sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
</sourceDirectories>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.1</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>CLASS</element>
<limits>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>0.8</minimum>
</limit>
<limit>
<counter>CLASS</counter>
<value>MISSEDCOUNT</value>
<maximum>0</maximum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.9.1.2184</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.11.0</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<reportSets>
<reportSet>
<reports>
<report>aggregate</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>
pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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>
<parent>
<artifactId>chips-distribution-game-parent</artifactId>
<groupId>nl.han.aim.asd.game</groupId>
<version>0.0.1</version>
<relativePath>parent.xml</relativePath>
</parent>
<artifactId>agent</artifactId>
<version>0.0.1</version>
<name>chips-distribution-game-agent-component</name>
<repositories>
<repository>
<id>gitlab-maven-antlr4</id>
<url>http://gitlab.devops.aimsites.nl/api/v4/projects/152/packages/maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>gitlab-maven-antlr4</id>
<url>http://gitlab.devops.aimsites.nl/api/v4/projects/152/packages/maven</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.10.1</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<!--
<dependency>
<groupId>nl.han.aim.asd.game</groupId>
<artifactId>persistence</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>nl.han.aim.asd.game</groupId>
<artifactId>shared-dtos</artifactId>
<version>0.0.1</version>
</dependency>
-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.10.1</version>
<executions>
<execution>
<id>antlr</id>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>check</id>
<configuration>
<rules>
<rule>
<excludes>
<exclude>nl.han.aim.asd.game.agent.App</exclude>
<exclude>nl.han.aim.asd.game.agent.parser.AgentParser</exclude>
<exclude>nl.han.aim.asd.game.agent.parser.AgentParser.*</exclude>
<exclude>nl.han.aim.asd.game.agent.ast.*</exclude>
<exclude>nl.han.aim.asd.game.agent.demo.*</exclude>
<exclude>nl.han.aim.asd.game.agent.datastructures.*</exclude>
</excludes>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>shade</id>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>nl.han.aim.asd.game.agent.App</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
And a mvn clean
resulted in:
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< nl.han.aim.asd.game:agent >----------------------
[INFO] Building chips-distribution-game-agent-component 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.7:prepare-agent (default) @ agent ---
...
[INFO] --- antlr4-maven-plugin:4.10.1:antlr4 (antlr) @ agent ---
[INFO] No ANTLR 4 grammars to compile in /home/bart/Temp/pom-tets/src/main/antlr4
[INFO]
...
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.631 s
[INFO] Finished at: 2022-05-12T10:40:36 02:00
[INFO] ------------------------------------------------------------------------
CodePudding user response:
Your main problem is that your statement "[JavaFX] forces me to make the whole project modular" is simply wrong. You can easily write a JavaFX application in a non-modular fashion. I am doing that for years.