apache / lucene

Apache Lucene open-source search software
https://lucene.apache.org/
Apache License 2.0
2.68k stars 1.04k forks source link

`gradlew eclipse` no longer works #13638

Closed uschindler closed 2 months ago

uschindler commented 3 months ago

Description

Hi @dweiss, since your last cleanup, when trying to run gradlew eclipse it complains because the task does not exist. Looks ike the reason is that the root project no longer is a Java project, so the plugin is not applied. When commenting out the plugins.withType(JavaPlugin) it breaks with an NPE.

No sure how to fix this. We need the eclipse plugin ONLY on root project because we use it to create a global project.

Version and environment details

No response

uschindler commented 3 months ago

Looks like this is caused by #13484

uschindler commented 3 months ago

Theres also some minor issue: Since this commit, whenever I commit something to the repo it complains about line endings of versions.toml:

warning: in the working copy of 'versions.toml', CRLF will be replaced by LF the next time Git touches it

This happens after every time I execute Gradle.

dweiss commented 3 months ago

Hi Uwe. Sorry, I was away on holidays. The cr-lf warning is caused by normalization in .gitattributes:

# Ignore all differences in line endings for the lock file.
versions.lock  text eol=lf
versions.toml  text eol=lf

Which git version are you using? I ask because I don't see this message. I'm also not sure how you ended up with crlfs in that file.

I'll take a look at the eclipse issue. I don't think I've changed anything that could affect it - maybe it's something indirect.

uschindler commented 2 months ago

I will check what's wrong with my toml file. I have crlf handling completely switched off in my git config. It should not touch any line endings.

dweiss commented 2 months ago

Which git version are you using? I think tidy will "clean up" those toml files by reordering them - there is a plugin for doing this. This plugin may be writing crlfs... but I don't see the warning you're getting (on Windows), which is strange!

dweiss commented 2 months ago

It's the plugin that formats version catalog - versionCatalogFormatDeps task writes back the file with the default encoding/ platform line endings. I've added a post-processing step to normalize this. I'm still surprised your git version is showing a warning about it.

dweiss commented 2 months ago

I compared main with 8f50976c268. When you list the plugins applied to the root project, it'll give you this:

class org.gradle.api.plugins.HelpTasksPlugin$Inject
class org.gradle.buildinit.plugins.BuildInitPlugin$Inject
class org.gradle.buildinit.plugins.WrapperPlugin$Inject
class org.gradle.language.base.plugins.LifecycleBasePlugin$Inject
class org.gradle.api.plugins.BasePlugin$Inject
class org.gradle.api.plugins.JvmEcosystemPlugin$Inject
class org.gradle.api.plugins.ReportingBasePlugin$Inject
class org.gradle.api.plugins.JvmToolchainsPlugin$Inject
class org.gradle.api.plugins.JavaBasePlugin$Inject
class com.palantir.gradle.versions.VersionsLockPlugin
class com.palantir.gradle.versions.VersionsPropsPlugin
class com.palantir.gradle.versions.GetVersionPlugin
class com.palantir.gradle.versions.ConsistentVersionsPlugin
class org.owasp.dependencycheck.gradle.DependencyCheckPlugin
class org.gradle.plugins.ide.eclipse.EclipsePlugin$Inject
class de.undercouch.gradle.tasks.download.DownloadTaskPlugin

whereas after removing the palantir plugins, it'll give you this:

class org.gradle.api.plugins.HelpTasksPlugin$Inject
class org.gradle.buildinit.plugins.BuildInitPlugin$Inject
class org.gradle.buildinit.plugins.WrapperPlugin$Inject
class org.gradle.language.base.plugins.LifecycleBasePlugin$Inject
class org.gradle.api.plugins.BasePlugin$Inject
class org.apache.lucene.gradle.buildinfra.BuildInfraPlugin
class com.carrotsearch.gradle.dependencychecks.DependencyChecksPlugin
class com.github.benmanes.gradle.versions.VersionsPlugin
class org.owasp.dependencycheck.gradle.DependencyCheckPlugin
class nl.littlerobots.vcu.plugin.VersionCatalogUpdatePlugin
class de.undercouch.gradle.tasks.download.DownloadTaskPlugin

I think palantir's plugin has a side-effect of applying the java conventions to the root project [1], but it's not necessary - that's why I only apply it in the eclipse task, where it is required for the jdt. I've changed java-library to java-base though, it should have a minimal surface impact.

[1] https://github.com/palantir/gradle-consistent-versions/blob/develop/src/main/java/com/palantir/gradle/versions/VersionsLockPlugin.java#L237-L239

uschindler commented 2 months ago

I have the git version shipped with TortoiseGit (rather new one, can check later).

Basically the warning was not the most annoying thing, it was more that the file was reported as changed in the GUI, so whole repository gets red in its explorer overlay icons.