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

Extensions Not Visible in Gradle Sub-projects #459

Closed
gudenau opened this issue Jul 1, 2023 · 1 comment
Closed

Extensions Not Visible in Gradle Sub-projects #459

gudenau opened this issue Jul 1, 2023 · 1 comment

Comments

@gudenau
Copy link

gudenau commented Jul 1, 2023

Describe the bug
When a Gradle project has a sub-project defines an extension other Gradle sub-projects/the root project can not see the extensions.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Gradle project
  2. Create a sub-project
  3. Make the root project depend on the sub-project
  4. Create an extension in the sub project
  5. Attempt to use extension in another project
  6. javac can't see the extension and can not compile the class that uses the extension

Expected behavior
The extensions should be available in all projects that depend on the project that contains the extensions.

Screenshots
image
image
image
(Plugin issue for lint problems is at manifold-systems/manifold-ij#16)

Desktop (please complete the following information):

  • OS Type & Version: Windows 10
  • Java/JDK version: 20
  • IDE version (IntelliJ IDEA or Android Studio): IntelliJ IDEA 2023.1.3 (Community Edition)
  • Manifold version: 2023.1.10
  • Manifold IntelliJ plugin version: 2023.1.10

Additional context
Minimal project to reproduce the issue: ManifoldBug.zip

Stack trace

8:51:51 PM: Executing ':RootTest.main()'...

> Task :sub:compileJava UP-TO-DATE
> Task :sub:processResources NO-SOURCE
> Task :sub:classes UP-TO-DATE
> Task :sub:jar UP-TO-DATE

> Task :compileJava FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0/userguide/command_line_interface.html#sec:command_line_warnings
3 actionable tasks: 1 executed, 2 up-to-date
C:\Users\gudenau\IdeaProjects\ManifoldBug\src\main\java\root\RootTest.java:5: error: cannot find symbol
        new Object().subExtension();
                    ^
  symbol:   method subExtension()
  location: class Object
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
8:51:52 PM: Execution finished ':RootTest.main()'.
@rsmckinney
Copy link
Member

If you want the extensions to be accessible from your jar, you must add the Contains-Sources manifest attribute.

jar {
 manifest {
   attributes('Contains-Sources':'java,class')
 }
}

See the documentation for Extension Libraries.

@gudenau gudenau closed this as completed Jul 3, 2023
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