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

Submodule jar is not built as part of submodule dependency. #59

Closed
chali opened this issue Mar 27, 2019 · 2 comments
Closed

Submodule jar is not built as part of submodule dependency. #59

chali opened this issue Mar 27, 2019 · 2 comments

Comments

@chali
Copy link
Member

chali commented Mar 27, 2019

My expectation is when you have a submodule dependency:

//project :impl

dependencies {
    api project(':api')
}

When I build ./gradlew :impl I will see as part of the output:

> Task :api:jar

However, that is not the case in this project. https://github.com/nebula-plugins/gradle-nebula-integration/tree/master/jar-not-build

You can run ./gradlew :impl:classes

To get:

> Task :lib:compileJava
> Task :lib:processResources NO-SOURCE
> Task :lib:classes
> Task :lib:jar
> Task :api:compileJava
> Task :impl:compileJava
> Task :impl:processResources NO-SOURCE
> Task :impl:classes

BUILD SUCCESSFUL in 0s
4 actionable tasks: 4 executed
@ljacomet
Copy link
Contributor

ljacomet commented Apr 1, 2019

What you see is the illustration of a key difference between the java and java-library plugin.

With the java plugin, the runtimeElements and apiElements outgoing configurations both only have the variant with the jar artifact. That means that either for compiling or running, anything that requests java-api or java-runtime can only consume the jar produced by the project.

However with the java-library plugin, there is another variant registered with apiElements, the classes one. That variant produces a org.gradle.usage=java-api-classes which is sourced from the main source set compileJava task and is compatible with the java-api usage request.
It effectively states that for compilation, we can use directly the produced class file without the need for a jar to be built.

That's why only api:compileJava is executed.

Is the question just informative or is that causing unexpected missing jar files in a project?

@chali
Copy link
Member Author

chali commented May 20, 2019

The situation is the proper behavior of java-library plugin.

@chali chali closed this as completed May 20, 2019
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