[
https://issues.apache.org/jira/browse/MCOMPILER-421?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17146919#comment-17146919
]
John Patrick commented on MCOMPILER-421:
----------------------------------------
With `mvn compile` I get this the following issue, so no idea what your
suggesting;
{code}
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR]
PATH/org.apache.maven_maven-compiler-plugin_MCOMPILER-422/workaround-no-provides/service-implementation/src/main/java11/module-info.java:[3,31]
error: module not found: workaround.service.interfaces
[INFO] 1 error
{code}
Regarding `mvn clean install`, yes I am aware most people suggest `mvn clean
verify` but I find using verify does not work in lots of situations. When
working with lots of git repos, it saves have to do lots of little releases of
minor changes. And I know lots say why are you install lots into your repo and
it just grows over time, which is why I use this to automatically clean old
releases from your local repo.
{code}
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>remove-project-artifact-default</id>
<goals>
<goal>remove-project-artifact</goal>
</goals>
<configuration>
<removeAll>true</removeAll>
</configuration>
</execution>
<execution>
<id>remove-project-artifact-clean</id>
<phase>clean</phase>
<goals>
<goal>remove-project-artifact</goal>
</goals>
<configuration>
<removeAll>true</removeAll>
</configuration>
</execution>
</executions>
</plugin>
{code}
> multi release jar issue with module-info.java when using provides
> -----------------------------------------------------------------
>
> Key: MCOMPILER-421
> URL: https://issues.apache.org/jira/browse/MCOMPILER-421
> Project: Maven Compiler Plugin
> Issue Type: Improvement
> Affects Versions: 3.8.1
> Reporter: John Patrick
> Priority: Major
>
> If you have the following structure you have to recompile everything for each
> version supported.
> If you have the following code;
> {code}
> src/main/java/package/Service.java (1)
> src/main/java/package/Example.java (2)
> src/main/java/package/Java1dot8.java (3)
> src/main/java11/package/Example.java (4)
> src/main/java11/package/Java11.java (5)
> src/main/java11/module-info.java (6)
> src/main/java14/package/Example.java (7)
> src/main/java14/package/Java14.java (8)
> src/main/java14/module-info.java (9)
> {code}
> I expect the following jar structure;
> {code}
> package/Service.class (1)
> package/Example.class (2)
> package/Java1dot8.class (3)
> META-INF/versions/11/package/Example.java (4)
> META-INF/versions/11/package/Java11.java (5)
> META-INF/versions/11/module-info.java (6)
> META-INF/versions/14/package/Example.java (7)
> META-INF/versions/14/package/Java14.java (8)
> META-INF/versions/14/module-info.java (9)
> {code}
> Using the following maven configuration;
> {code}
> <executions>
> <execution>
> <id>java11-main</id>
> <phase>compile</phase>
> <goals>
>
> <goal>compile</goal>
> </goals>
> <configuration>
>
> <release>11</release>
> <jdkToolchain>
>
> <version>11</version>
> </jdkToolchain>
>
> <compileSourceRoots>
>
> <compileSourceRoot>${project.basedir}/src/main/java11</compileSourceRoot>
>
> </compileSourceRoots>
>
> <multiReleaseOutput>true</multiReleaseOutput>
> </configuration>
> </execution>
> <execution>
> <id>java14-main</id>
> <phase>compile</phase>
> <goals>
>
> <goal>compile</goal>
> </goals>
> <configuration>
>
> <release>14</release>
> <jdkToolchain>
>
> <version>14</version>
> </jdkToolchain>
>
> <compileSourceRoots>
>
> <compileSourceRoot>${project.basedir}/src/main/java14</compileSourceRoot>
>
> </compileSourceRoots>
>
> <multiReleaseOutput>true</multiReleaseOutput>
> </configuration>
> </execution>
> </executions>
> {code}
> But due to needing to use provides and uses in the module-info.java
> {code}
> module MODULE_A {
> exports PACKAGE_A;
> uses PACKAGE_B.Service;
> provides PACKAGE_B.Service
> with PACKAGE_A.ServiceImpl;
> }
> {code}
> I get compile errors with src/main/java11/module-info.java as that class is
> under src/main/java. So I need to change it to something like this so the
> compile see classes already compiled that are in target/classes;
> {code}
> <executions>
> <execution>
> <id>java11-main</id>
> <phase>compile</phase>
> <goals>
>
> <goal>compile</goal>
> </goals>
> <configuration>
>
> <release>11</release>
> <jdkToolchain>
>
> <version>11</version>
> </jdkToolchain>
>
> <compileSourceRoots>
>
> <compileSourceRoot>${project.basedir}/src/main/java</compileSourceRoot>
>
> <compileSourceRoot>${project.basedir}/src/main/java11</compileSourceRoot>
>
> </compileSourceRoots>
>
> <multiReleaseOutput>true</multiReleaseOutput>
> </configuration>
> </execution>
> <execution>
> <id>java14-main</id>
> <phase>compile</phase>
> <goals>
>
> <goal>compile</goal>
> </goals>
> <configuration>
>
> <release>14</release>
> <jdkToolchain>
>
> <version>14</version>
> </jdkToolchain>
>
> <compileSourceRoots>
>
> <compileSourceRoot>${project.basedir}/src/main/java</compileSourceRoot>
>
> <compileSourceRoot>${project.basedir}/src/main/java11</compileSourceRoot>
>
> <compileSourceRoot>${project.basedir}/src/main/java14</compileSourceRoot>
>
> </compileSourceRoots>
>
> <multiReleaseOutput>true</multiReleaseOutput>
> </configuration>
> </execution>
> </executions>
> {code}
> Which then produces a jar looking something like this;
> {code}
> package/Service.class (1)
> package/Example.class (2)
> package/Java1dot8.class (3)
> META-INF/versions/11/package/Java1dot8.class (3)
> META-INF/versions/11/package/Example.java (4)
> META-INF/versions/11/package/Java11.java (5)
> META-INF/versions/11/module-info.java (6)
> META-INF/versions/14/package/Java1dot8.class (3)
> META-INF/versions/14/package/Java11.java (5)
> META-INF/versions/14/package/Example.java (7)
> META-INF/versions/14/package/Java14.java (8)
> META-INF/versions/14/module-info.java (9)
> {code}
> One of the projects that needs this is
> https://github.com/nhojpatrick/nhojpatrick-cucumber/tree/feature/surefire-3.0.0-M5
> The actual module-info.java using provides is
> https://github.com/nhojpatrick/nhojpatrick-cucumber/blob/feature/surefire-3.0.0-M5/json-transformations/remove/src/main/java11/module-info.java
--
This message was sent by Atlassian Jira
(v8.3.4#803005)