0

I have used Maven with earlier versions of Java but now I am trying to get it to work with Java 10. I built a simple Hello world project, specifically:

package main;

public class Test {

public static void main(String[] args) {
    System.out.println("Hello World");

}

} With a module-info class:

module maven.test { exports main; }

The pom associated with this project is:

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 MavenTest MavenTest 0.0.1-SNAPSHOT MavenTest src maven-compiler-plugin 3.7.0 10

When I build the project, it build successfully. I then added a dependency from the Maven central repository: org.jsoup jsoup 1.7.3

This too builds successfully. I then add a locally installed jar.

<dependency>
    <groupId>com.artificialmed</groupId>
    <artifactId>DBconnectValueObjects</artifactId>
    <version>1.0</version>
</dependency>

When I do this, I get a Build Failure with the following error message:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project MavenTest: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile failed. IllegalArgumentException -> [Help 1] [ERROR]

I've not found anything that would help me resolve this error. When I rebuilt the project using full debugging logging, I saw no useful information. I know the local jar was installed in my repository correctly because when I include that jar in projects compiled in Java 7, the project builds successfully. So, I suspect this is some issue related to Java 10 and locally installed jars.

Does anyone know how to get around this issue?

Elliott

Elliott
  • 5,523
  • 10
  • 48
  • 87

1 Answers1

1

I think this might be related to this question.

Basically, I don't think your problem is related to the local jar - If you've installed it in your local maven repository ($USER_HOME/.m2) using the maven install plugin, it has a pom.xml and to maven shouldn't be distinguishable from any other maven dependency.

The only thing I see "wrong" is the version of the maven compiler plugin - the current version is 3.8.0, which I'm using with Java 11 without any issues so far. Also, note that the mechanism to set the source and target java releases changed, as in the following snippet:

    <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <release>10</release>
            </configuration>
        </plugin>
    </plugins>
</build>