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

Javadoc destination directory being deleted #8407

Closed
davidbokor opened this issue Feb 4, 2019 · 4 comments
Closed

Javadoc destination directory being deleted #8407

davidbokor opened this issue Feb 4, 2019 · 4 comments

Comments

@davidbokor
Copy link

davidbokor commented Feb 4, 2019

One of our projects uses an external SDK and we want to have our Javadocs include the classes from that external project. We copy the javadocs into a subdirectory of $buildDir/javadocs and link to them as follows:

task unzipOtherProjectDocs(type:Copy) {
	into "$buildDir/javadocs/someOtherProject"
	from zipTree(configurations.someOtherProjectDocs.singleFile)
}

javadoc {
	...
	dependsOn unzipOtherProjectDocs
	options.links("https://docs.oracle.com/javase/8/docs/api/")
	options.links("/someOtherProject")
}

Starting with Gradle 5 and verified with 5.1.1 and 5.2, we get the following warning while building:

javadoc: warning - Error reading file: c:\MyProject\build\javadocs\someOtherProject\package-list

...and the links to the javadocs in /someOtherProject no longer work.

I thought it might be related to Issue #8183 but since has been fixed, perhaps not.

@davidbokor davidbokor reopened this Feb 4, 2019
@davidbokor
Copy link
Author

davidbokor commented Feb 4, 2019

It turns out that starting with Gradle 5, the Javadoc plugin is deleting the destination directory before executing.. There doesn't seem to be a way to disable that. Is there a reason for this behavior change?

@davidbokor davidbokor changed the title Error linking to other javadocs Javadoc destination directory being deleted Feb 4, 2019
@thc202
Copy link
Contributor

thc202 commented Feb 4, 2019

That was changed per #6168.

@davidbokor
Copy link
Author

It doesn't look like there's a way to disable the cleaning of the directory or to inject some task that runs after the clean. Perhaps either could be added?

I'm a little surprised that #6168 was implemented instead of just suggesting adding a doFirst() to the task declaration.

@big-guy
Copy link
Member

big-guy commented Feb 5, 2019

This is intentional behavior for the reasons in #6168. The Javadoc task should just work out-of-the-box, so asking users to add a doFirst wouldn't work. Making sure the output represents only the output from the javadoc task lets Gradle cache the output in the build cache.

Could you get by with something like:

task unzipOtherProjectDocs(type: Sync) { 
    into "$buildDir/extdocs/someOtherProject" 
    from zipTree(configurations.someOtherProjectDocs.singleFile) 
} 

javadoc { 
    dependsOn unzipOtherProjectDocs 
    options.links("https://docs.oracle.com/javase/8/docs/api/") 
    options.links("../extdocs/someOtherProject") 
}

@big-guy big-guy closed this as completed Feb 5, 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

3 participants