-
Notifications
You must be signed in to change notification settings - Fork 0
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
Use the implementation
configuration to replace compile
#40
Conversation
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@scalar-labs/scalar-admin", | |||
"version": "2.1.0", | |||
"version": "2.1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we update this because now the version of Java and Node are aligned so they have to be updated at the same time.
@@ -102,7 +102,7 @@ targetCompatibility = 1.8 | |||
|
|||
group = "com.scalar-labs" | |||
archivesBaseName = "scalar-admin" | |||
version = "2.1.0" | |||
version = "2.1.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a bug fix? or an improvement? It's labeled as improvement, so they look inconsistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, it's a mistake on label.
It should be a bugfix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it's an improvement.
So after we merge this, are we going to release 2.1.1
? Actually, I don't think we need to release it right away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the advise.
I see. Let me revise it as an improvement.
I was thinking it's a bugfix because:
For example, I am using scalar-admin's RequestCoordinator class in another project scalar-admin-k8s (an additional tool for pausing Scalar products in Kubernetes environemtn).
RequestCoordinator depends on, for an instance, the dnsjava package.
However, because the dnsjava dependency is declared with compile
here, so it won't be included in the runtime classpath.
In other words, the scalar-admin-k8s using RequestCoordinator needs to declare dnsjava as a runtime dependency by itself.
This is what I add additionally to the build.gradle of scalar-admin-k8s.
// FIXME these declarations are due to the drawbacks of using the `compile` configuration in scalar-admin 2.1.0.
// Remove these declarations when it's fixed in scalar-admin after 2.1.0.
implementation group: 'javax.json', name: 'javax.json-api', version: '1.1.4'
implementation group: 'org.glassfish', name: 'javax.json', version: '1.1.4'
implementation group: 'dnsjava', name: 'dnsjava', version: '3.5.2'
implementation group: 'io.grpc', name: 'grpc-alts', version: '1.51.0'
implementation group: 'io.grpc', name: 'grpc-netty', version: '1.51.0'
implementation group: 'io.grpc', name: 'grpc-protobuf', version: '1.51.0'
implementation group: 'io.grpc', name: 'grpc-stub', version: '1.51.0'
implementation group: 'com.google.api.grpc', name: 'proto-google-common-protos', version: '1.0.0'
implementation group: 'com.google.api.grpc', name: 'googleapis-common-protos', version: '0.0.3'
implementation group: 'com.google.protobuf', name: 'protobuf-java-util', version: '3.21.12'
(almost copied the whole dependency configuration from scalar-admin)
From scalar-admin-k8s perspective, I feel it's weird to do this because scalar-admin-k8s doesn't directly depends on these packages. The indirected packages should be declared at the library level (scalar-admin) which directly depends on these packages.
I think the issue won't happen in scalardl and scalardb because they only use the gRPC generated classes, and the generated classes depend on grpc-core which is for sure declared in scalardl and scalardb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds strange. If you declare the dependencies with compileOnly
, that would make sense. But if you declare the dependencies with compile
, they should be included in the class path.
But, I checked the pom file of scalar-admin-2.1.0
, and surprisingly it doesn't have any dependencies:
https://repo1.maven.org/maven2/com/scalar-labs/scalar-admin/2.1.0/scalar-admin-2.1.0.pom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, this is the build.gradle
file for ScalarDB 3.0.0:
https://github.com/scalar-labs/scalardb/blob/v3.0.0/build.gradle
In this file, the dependencies are declared with compile
(and testCompile
).
And the pom file for this release is as follows:
https://repo1.maven.org/maven2/com/scalar-labs/scalardb/3.0.0/scalardb-3.0.0.pom
The dependencies are included in the dependencies
part in pom.xml.
I think that's a normal situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your hint!
I found the magic occurs between the legacy maven plugin and the current maven-publish plugin. They are in charge of creating POM files.
This is the POM file of scalar-admin 1.1.0
https://repo1.maven.org/maven2/com/scalar-labs/scalar-admin/1.1.0/scalar-admin-1.1.0.pom
(the compile
dependencies are there)
and, before 1.2.0, I made this commit to replace the legacy maven plugin with maven-publish
72replacingc8237f7d181b702d99acd63dd3134955110312
it caused the POM file of scalar-admin 1.2.0
https://repo1.maven.org/maven2/com/scalar-labs/scalar-admin/1.2.0/scalar-admin-1.2.0.pom (the dependencies are gone)
It seems that the legacy maven plugin puts the compile
dependencies into the POM but the maven-publish plugin doesn't.
And I found a source code snippet of the maven-publish plugin.
The maven-publish seems to treat the compile
dependency as the api
dependency, which will not be included in the runtime classpath. Then it explains...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, I guess the reason I switched to maven-plugin is in order to publish it to local maven repo and test it with another project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like an api
dependency in build.gradle is interpreted as a compile
scope dependency in pom.xml.
build.gradle:
https://github.com/scalar-labs/scalardb/blob/v3.9.0/rpc/build.gradle
pom.xml:
https://repo1.maven.org/maven2/com/scalar-labs/scalardb-rpc/3.9.0/scalardb-rpc-3.9.0.pom
So the maven-publish
plugin just ignores the compile
dependencies in build.gradle? That's weird...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
java/build.gradle
Outdated
compile group: 'io.grpc', name: 'grpc-stub', version: "${grpcVersion}" | ||
compile group: 'com.google.protobuf', name: 'protobuf-java-util', version: "${protobufVersion}" | ||
compile group: 'dnsjava', name: 'dnsjava', version: '2.1.9' | ||
implementation group: 'org.slf4j', name: 'slf4j-api', version: "${slf4jVersion}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using the short format?
implementation group: 'org.slf4j', name: 'slf4j-api', version: "${slf4jVersion}" | |
implementation "org.slf4j:slf4j-api:${slf4jVersion}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -102,7 +102,7 @@ targetCompatibility = 1.8 | |||
|
|||
group = "com.scalar-labs" | |||
archivesBaseName = "scalar-admin" | |||
version = "2.1.0" | |||
version = "2.1.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it's an improvement.
So after we merge this, are we going to release 2.1.1
? Actually, I don't think we need to release it right away.
@supl What should we do for this PR? |
Sorry for taking so long. Regarding the feedback from Toshi I was trying to find why the maven-publish plugin ignores the dependencies with the However, I think it's a correct change to replace the
So, I think I will stop digging the maven-publish plugin and just use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one comment. Other than that, LGTM! Thank you!
Co-authored-by: Toshihiro Suzuki <brfrn169@gmail.com>
I also change the version of the node package to 2.1.1 to align the Java's version. |
@supl What should we do about this? Is it OK with the bugfix label? |
I think we can merge it and it should be a bugfix. |
This PR revises the Gradle build system.
It uses the
implementation
configuration to replacecompile
.This is because the
compile
configuration is deprecated and using thecompile
configuration doesn't include the dependencies into the jar file.