简体   繁体   中英

How to attach the source to the jar in the Gradle Eclipse Project when the source attachment is not modifiable?

There is a similar question ( How do I attach source code into a project's library in Eclipse? ).

However, in my case the jar has the description non modifiable and the option Edit is not possible. What to do in this case?

Here is the picture.
在此处输入图片说明

For homegrown projects the solution is to create a source jar for the library that you use. This can be done by adding to build.gradle

task sourceJar(type: Jar, dependsOn: classes) {
    classifier 'sources'
    from sourceSets.main.allSource
}

And then add to publications:

artifact sourceJar

Publish the jars to the local Maven repository, then the source will be attached in Eclipse while referring this library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM