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

[ISSUE-883] Transitively export the dependencies of [eventmesh-sdk-java] to other module #884

Merged
merged 6 commits into from
May 27, 2022
Merged

Conversation

HoffmanZheng
Copy link
Contributor

Fixes ISSUE #883 .

Motivation

eventmesh-sdj-java is a library module, should transitively export the dependencies, which are necessary for development of eventmesh-application.

Modifications

Add gradle plugin java-library in eventmesh-sdk-java

Change the configuration of following dependencies from implementation to api:

  • project(":eventmesh-common")
  • io.cloudevents:cloudevents-core
  • io.cloudevents:cloudevents-json-jackson
  • io.openmessaging:openmessaging-api
  • org.projectlombok:lombok:1.18.22

Documentation

Not a new feature, thus no doc needed.

@codecov
Copy link

codecov bot commented May 21, 2022

Codecov Report

Merging #884 (1cb673d) into master (c055e83) will decrease coverage by 0.02%.
The diff coverage is n/a.

❗ Current head 1cb673d differs from pull request most recent head 95e0fc4. Consider uploading reports for the commit 95e0fc4 to get more accurate results

@@             Coverage Diff             @@
##             master    #884      +/-   ##
===========================================
- Coverage      7.09%   7.06%   -0.03%     
  Complexity      442     442              
===========================================
  Files           346     346              
  Lines         21695   21691       -4     
  Branches       2415    2411       -4     
===========================================
- Hits           1539    1533       -6     
- Misses        20039   20041       +2     
  Partials        117     117              
Impacted Files Coverage Δ
...ava/org/apache/eventmesh/common/utils/IPUtils.java 34.25% <0.00%> (-5.56%) ⬇️
...rg/apache/eventmesh/runtime/trace/LogExporter.java 0.00% <0.00%> (ø)
...l/tcp/client/recommend/EventMeshRecommendImpl.java 0.00% <0.00%> (ø)
.../tcp/client/session/push/DownStreamMsgContext.java 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c055e83...95e0fc4. Read the comment docs.

Copy link
Contributor Author

@HoffmanZheng HoffmanZheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted, see below.

Copy link
Contributor Author

@HoffmanZheng HoffmanZheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though maven-publish is included in the project, there should be a committor to do the related test.

@@ -15,10 +15,15 @@
* limitations under the License.
*/

plugins {
id 'java-library'
id 'com.github.johnrengelman.shadow' version '7.1.2'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I use the java-library and change the dependency configuration to api, the built jar file still does not contain the dependencies.
Thus the shadow plugin used here to generate a fat jar. (for your reference)

@ruanwenjun
Copy link
Member

Good catch. Right now, the scope of eventmesh-common in eventmesh-sdk-java is implementation, so if we want to use eventmesh-sdk-java in our app, we need to add the eventmesh-common to our dependency. We need to change the scope from implementation to api to solve this.

And I think we don't need to make a shawdow jar. cc @xwm1992

@ruanwenjun ruanwenjun added this to the 1.5.0 milestone May 22, 2022
@ruanwenjun ruanwenjun added the improvement Improve the mechanism or performance label May 22, 2022
@HoffmanZheng HoffmanZheng changed the title [ISSUE-883] Transitively export the dependencies of [eventmesh-sdk-java] to other module [WIP][ISSUE-883] Transitively export the dependencies of [eventmesh-sdk-java] to other module May 23, 2022
@HoffmanZheng
Copy link
Contributor Author

HoffmanZheng commented May 23, 2022

Good catch. Right now, the scope of eventmesh-common in eventmesh-sdk-java is implementation, so if we want to use eventmesh-sdk-java in our app, we need to add the eventmesh-common to our dependency. We need to change the scope from implementation to api to solve this.

And I think we don't need to make a shawdow jar. cc @xwm1992

Currently I'm trying to use the following script to generate a fat jar of [eventmesh-sdk-java] (without the usage of shadow plugin), sometimes it works. Mark the PR work in progress.

jar {
    from {
        configurations. runtimeClasspath.filter{ it.exists() }.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

@ruanwenjun
Copy link
Member

Good catch. Right now, the scope of eventmesh-common in eventmesh-sdk-java is implementation, so if we want to use eventmesh-sdk-java in our app, we need to add the eventmesh-common to our dependency. We need to change the scope from implementation to api to solve this.
And I think we don't need to make a shawdow jar. cc @xwm1992

Currently I'm trying to use the following script to generate a fat jar of [eventmesh-sdk-java] (without the usage of shadow plugin), sometimes it works. Mark the PR work in progress.

jar {
    from {
        configurations. runtimeClasspath.filter{ it.exists() }.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

I suggest we just change the scope of eventmesh-commom to spi is enough.

@HoffmanZheng
Copy link
Contributor Author

I used to use the gradle jar and mvn install:install-file to do dependencies resolving test, and it does not work.
Rather using gradle publishToMavenLocal, the dependencies could be transitively exported to other module!

@HoffmanZheng HoffmanZheng changed the title [WIP][ISSUE-883] Transitively export the dependencies of [eventmesh-sdk-java] to other module [ISSUE-883] Transitively export the dependencies of [eventmesh-sdk-java] to other module May 25, 2022
@qqeasonchen
Copy link
Contributor

@HoffmanZheng any update?

HoffmanZheng and others added 2 commits May 26, 2022 13:55
@HoffmanZheng
Copy link
Contributor Author

@HoffmanZheng any update?

updated

Copy link
Member

@ruanwenjun ruanwenjun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qqeasonchen qqeasonchen merged commit 276c082 into apache:master May 27, 2022
xwm1992 pushed a commit that referenced this pull request Aug 4, 2022
[ISSUE-883] Transitively export the dependencies of [eventmesh-sdk-java] to other module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improve the mechanism or performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants