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

Please publish an Automatic-Module-Name #597

Open
io7m opened this Issue Feb 3, 2018 · 5 comments

Comments

Projects
None yet
5 participants
@io7m

io7m commented Feb 3, 2018

Hello.

When using auto to generate code for a modular Java 9 project, you'll get complaints from tools about depending on an automatically-generated module name.

Is there any chance you could add an Automatic-Module-Name entry in the jar manifest in order to provide a stable name upon which other Java 9 projects can depend? I'd suggest:

Automatic-Module-Name: com.google.auto.value

@eamonnmcmanus eamonnmcmanus self-assigned this Feb 6, 2018

@ronshapiro

This comment has been minimized.

Contributor

ronshapiro commented Feb 21, 2018

AutoValue is entirely source-level annotations - does that change the picture?

@io7m

This comment has been minimized.

io7m commented Feb 21, 2018

Nope: You're still required to specify a requires static clause in a modular project in order to be able to use the annotations at compile time.

module com.example.mine {
  requires static com.google.auto.value;
}
@heruan

This comment has been minimized.

heruan commented Mar 7, 2018

I'm not able to require the automatic module with the name that should be derived from the JAR file, i.e. auto.service.

I checked with:

$ jar --describe-module --file=$HOME/.m2/repository/com/google/auto/service/auto-service/1.0-rc4/auto-service-1.0-rc4.jar
No module descriptor found. Derived automatic module.

auto.service@1.0-rc4 automatic
requires java.base mandated
provides javax.annotation.processing.Processor with com.google.auto.service.processor.autoserviceprocessor
contains com.google.auto.service
contains com.google.auto.service.processor

but no luck, with requires auto.service I always get:

auto.service cannot be resolved as a module

What am I missing?

@io7m

This comment has been minimized.

io7m commented May 14, 2018

@eamonnmcmanus Any movement on this? It's very much a harmless one-line addition to the jar manifest.

@tbroyer

This comment has been minimized.

Contributor

tbroyer commented May 14, 2018

very much a harmless

See http://blog.joda.org/2018/03/jpms-negative-benefits.html

To emphasise this, just adding something to the MANIFEST.MF file can have an effect on how the project is run and tested. You need to test on both the class-path and module-path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment