Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 9 Automatic Module Name #11

Closed
pitschr opened this issue Dec 6, 2019 · 1 comment
Closed

Java 9 Automatic Module Name #11

pitschr opened this issue Dec 6, 2019 · 1 comment

Comments

@pitschr
Copy link

pitschr commented Dec 6, 2019

When building JAR I noticed warning:

* Required filename-based automodules detected: [rotating-fos-0.9.0.jar]. Please don't publish this project to a public artifact repository! *

To fix it, you need to update the pom.xml

Add to <properties />

<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>

Add to <build/>

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-jar-plugin</artifactId>
	<version>${maven-jar-plugin.version}</version>
	<configuration>
		<archive>
			<manifestEntries>
				<Automatic-Module-Name>com.vlkan.rfos</Automatic-Module-Name>
			</manifestEntries>
		</archive>
	</configuration>
</plugin>

As it is updating the manifest in JAR file only with Automatic-Module-Name: com.vlkan.rfos I expect there should be no problem with Java 8 too.

The drawbacks is that currently the Java 9 modules which are consuming your library have currently:

module my.module {
   ... lines omitted ...
   requires rotating.fos;
}

With the entry in manifest the name of plugin will be stabilized for Java 9+ modules and they have to update their module-info.java to:

module my.module {
   ... lines omitted ...
   requires com.vlkan.rfos;
}

then. This is only the drawback. Adding a small comment in readme.md (perhaps a separate section for Java 9+ developers) would be also helpful. Can you please consider it for 0.9.1 release? I'll also add the Java 9+ module name to my library as well.

For further reference you may check out:
https://dzone.com/articles/automatic-module-name-calling-all-java-library-maintainers

vy added a commit that referenced this issue Dec 8, 2019
@vy
Copy link
Owner

vy commented Dec 8, 2019

@pitschr, done, see 66f181e. I have released v0.9.1 to Maven Central.

I have also spent some time to create a multi-release JAR bundle (incl. module-info.java), but could not succeed with my nonexisting skill set on Java 9 modules. I will give this one more try when I learn more about this stuff. For now, this quick-and-dirty hack should do the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants