diffplug / spotless

Keep your code spotless
Apache License 2.0
4.6k stars 460 forks source link

Resource missing with org.eclipse.swt.$%7Bosgi.platform%7D #1141

Open cxjava opened 2 years ago

cxjava commented 2 years ago

when i run ./gradlew spotlessApply --info it show below warning:

Resource missing. [HTTP GET: https://repo.maven.apache.org/maven2/org/eclipse/platform/org.eclipse.swt.$%7Bosgi.platform%7D/3.118.0/org.eclipse.swt.$%7Bosgi.platform%7D-3.118.0.pom]

// substitute(platform(module('org.eclipse.platform:org.eclipse.swt.${osgi.platform}:3.118.0'))). // using module('org.eclipse.platform:org.eclipse.swt.cocoa.macosx.x86_64:3.118.0') // substitute module('org.eclipse.platform:org.eclipse.swt.${osgi.platform}:3.118.0') with module("org.eclipse.platform:org.eclipse.swt.cocoa.macosx.x86_64:3.118.0") } } }


-  I also try to set the `ext['osgi.platform'] = 'cocoa.macosx.x86_64'` in the build.gradle file, seems don't fix this warning.

_my question is how I can set the osgi.plantform for this plugin?_

- [ ] gradle or maven version
gradle version: 7.4.0
- [ ] spotless version
id 'com.diffplug.spotless' version '6.3.0'
- [ ] operating system and version
macos catalina 10.15.7
- [ ] copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible

apply plugin: "com.diffplug.spotless" apply plugin: 'groovy'

spotless { groovy { importOrder() greclipse('4.21.0') } groovyGradle { greclipse() } }

- [ ] copy-paste the full content of any console errors emitted by `gradlew spotless[Apply/Check] --stacktrace`
```log
➜  aaaaaa git:(main) ✗ ./gradlew spotlessApply --info
Initialized native services in: /Users/xxx/.gradle/native
Initialized jansi services in: /Users/xxx/.gradle/native
The client will now receive all logging from the daemon (pid: 1678). The daemon log file: /Users/xxx/.gradle/daemon/7.4/daemon-1678.out.log
Starting 51st build in daemon [uptime: 1 hrs 44 mins 2.275 secs, performance: 100%]
Using 8 worker leases.
Now considering [/Users/xxx/Documents/git/aaaaaa] as hierarchies to watch
Watching the file system is configured to be enabled if available
File system watching is active
Starting Build
Settings evaluated using settings file '/Users/xxx/Documents/git/aaaaaa/settings.gradle'.
Using local directory build cache for the root build (location = /Users/xxx/.gradle/caches/build-cache-1, removeUnusedEntriesAfter = 7 days).
Projects loaded. Root project using build file '/Users/xxx/Documents/git/aaaaaa/build.gradle'.
Included projects: [root project 'aaaaaa']

> Configure project :
Evaluating root project 'aaaaaa' using build file '/Users/xxx/Documents/git/aaaaaa/build.gradle'.
Applying dependency management to configuration 'bootArchives' in project 'aaaaaa'
Applying dependency management to configuration 'archives' in project 'aaaaaa'
Applying dependency management to configuration 'default' in project 'aaaaaa'
Applying dependency management to configuration 'implementation' in project 'aaaaaa'
Applying dependency management to configuration 'compileOnly' in project 'aaaaaa'
Applying dependency management to configuration 'compileClasspath' in project 'aaaaaa'
Applying dependency management to configuration 'annotationProcessor' in project 'aaaaaa'
Applying dependency management to configuration 'runtimeOnly' in project 'aaaaaa'
Applying dependency management to configuration 'runtimeClasspath' in project 'aaaaaa'
Applying dependency management to configuration 'testImplementation' in project 'aaaaaa'
Applying dependency management to configuration 'testCompileOnly' in project 'aaaaaa'
Applying dependency management to configuration 'testCompileClasspath' in project 'aaaaaa'
Applying dependency management to configuration 'testAnnotationProcessor' in project 'aaaaaa'
Applying dependency management to configuration 'testRuntimeOnly' in project 'aaaaaa'
Applying dependency management to configuration 'testRuntimeClasspath' in project 'aaaaaa'
Applying dependency management to configuration 'testResultsElementsForTest' in project 'aaaaaa'
Applying dependency management to configuration 'apiElements' in project 'aaaaaa'
Applying dependency management to configuration 'runtimeElements' in project 'aaaaaa'
Applying dependency management to configuration 'mainSourceElements' in project 'aaaaaa'
Applying dependency management to configuration 'developmentOnly' in project 'aaaaaa'
Applying dependency management to configuration 'productionRuntimeClasspath' in project 'aaaaaa'
Current profile: local
Compiling script '/Users/xxx/Documents/git/aaaaaa/gradle/allprojects.gradle' using SubsetScriptTransformer.
Compiling script '/Users/xxx/Documents/git/aaaaaa/gradle/allprojects.gradle' using BuildScriptTransformer.
Applying dependency management to configuration 'integrationTestImplementation' in project 'aaaaaa'
Applying dependency management to configuration 'integrationTestCompileOnly' in project 'aaaaaa'
Applying dependency management to configuration 'integrationTestCompileClasspath' in project 'aaaaaa'
Applying dependency management to configuration 'integrationTestAnnotationProcessor' in project 'aaaaaa'
Applying dependency management to configuration 'integrationTestRuntimeOnly' in project 'aaaaaa'
Applying dependency management to configuration 'integrationTestRuntimeClasspath' in project 'aaaaaa'
Applying dependency management to configuration 'integrationTestCompile' in project 'aaaaaa'
Applying dependency management to configuration 'testCompile' in project 'aaaaaa'
Applying dependency management to configuration 'integrationTestRuntime' in project 'aaaaaa'
Applying dependency management to configuration 'testRuntime' in project 'aaaaaa'
Applying dependency management to configuration 'checkstyle' in project 'aaaaaa'
Applying dependency management to configuration 'pmd' in project 'aaaaaa'
Applying dependency management to configuration 'pmdAux' in project 'aaaaaa'
Applying dependency management to configuration 'mainPmdAuxClasspath' in project 'aaaaaa'
Applying dependency management to configuration 'testPmdAuxClasspath' in project 'aaaaaa'
Applying dependency management to configuration 'integrationTestPmdAuxClasspath' in project 'aaaaaa'
Applying dependency management to configuration 'jacocoAgent' in project 'aaaaaa'
Applying dependency management to configuration 'jacocoAnt' in project 'aaaaaa'
Applying dependency management to configuration 'coverageDataElementsForTest' in project 'aaaaaa'
Applying dependency management to configuration 'spotbugs' in project 'aaaaaa'
Applying dependency management to configuration 'spotbugsSlf4j' in project 'aaaaaa'
Applying dependency management to configuration 'spotbugsPlugins' in project 'aaaaaa'
All projects evaluated.
Selected primary task 'spotlessApply' from project :
Tasks to be executed: [task ':spotlessInternalRegisterDependencies', task ':spotlessGroovy', task ':spotlessGroovyApply', task ':spotlessGroovyGradle', task ':spotlessGroovyGradleApply', task ':spotlessJava', task ':spotlessJavaApply', task ':spotlessMisc', task ':spotlessMiscApply', task ':spotlessXml', task ':spotlessXmlApply', task ':spotlessApply', task ':autoLintGradle']
Tasks that were excluded: []
:spotlessInternalRegisterDependencies (Thread[Execution worker for ':',5,main]) started.

> Task :spotlessInternalRegisterDependencies UP-TO-DATE
Caching disabled for task ':spotlessInternalRegisterDependencies' because:
  Caching has not been enabled for the task
Skipping task ':spotlessInternalRegisterDependencies' as it is up-to-date.
:spotlessInternalRegisterDependencies (Thread[Execution worker for ':',5,main]) completed. Took 0.001 secs.
:spotlessGroovy (Thread[Execution worker for ':',5,main]) started.

> Task :spotlessGroovy
file or directory '/Users/xxx/Documents/git/aaaaaa/src/main/groovy', not found
file or directory '/Users/xxx/Documents/git/aaaaaa/src/main/groovy', not found
Applying dependency management to configuration 'spotless-1429330901' in project 'aaaaaa'
Resolving global dependency management for project 'aaaaaa'
Resource missing. [HTTP GET: https://repo.maven.apache.org/maven2/org/eclipse/platform/org.eclipse.swt.$%7Bosgi.platform%7D/3.118.0/org.eclipse.swt.$%7Bosgi.platform%7D-3.118.0.pom]
Resource missing. [HTTP GET: https://repo.gradle.org/artifactory/jcenter/org/eclipse/platform/org.eclipse.swt.$%7Bosgi.platform%7D/3.118.0/org.eclipse.swt.$%7Bosgi.platform%7D-3.118.0.pom]
Resource missing. [HTTP GET: https://repo.maven.apache.org/maven2/org/eclipse/platform/org.eclipse.swt.$%7Bosgi.platform%7D/3.118.0/org.eclipse.swt.$%7Bosgi.platform%7D-3.118.0.pom]
Resource missing. [HTTP GET: https://repo.gradle.org/artifactory/jcenter/org/eclipse/platform/org.eclipse.swt.$%7Bosgi.platform%7D/3.118.0/org.eclipse.swt.$%7Bosgi.platform%7D-3.118.0.pom]
Resource missing. [HTTP GET: https://dl.google.com/dl/android/maven2/org/eclipse/platform/org.eclipse.swt.$%7Bosgi.platform%7D/3.118.0/org.eclipse.swt.$%7Bosgi.platform%7D-3.118.0.pom]
Excluding []
Build cache key for task ':spotlessGroovy' is 5f0ec7f0d8f9b2b35c9e9d65d75d8d28
Skipping task ':spotlessGroovy' as it is up-to-date.

> Task :spotlessGroovy UP-TO-DATE
:spotlessGroovy (Thread[Execution worker for ':',5,main]) completed. Took 6.256 secs.
:spotlessGroovyApply (Thread[Execution worker for ':',5,main]) started.

> Task :spotlessGroovyApply UP-TO-DATE
Caching disabled for task ':spotlessGroovyApply' because:
  Caching has not been enabled for the task
Task ':spotlessGroovyApply' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
:spotlessGroovyApply (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:spotlessGroovyGradle (Thread[Execution worker for ':',5,main]) started.

> Task :spotlessGroovyGradle UP-TO-DATE
Build cache key for task ':spotlessGroovyGradle' is 387235f7d653affe785e849622eb38d5
Skipping task ':spotlessGroovyGradle' as it is up-to-date.
:spotlessGroovyGradle (Thread[Execution worker for ':',5,main]) completed. Took 0.003 secs.
:spotlessGroovyGradleApply (Thread[Execution worker for ':',5,main]) started.

> Task :spotlessGroovyGradleApply
Caching disabled for task ':spotlessGroovyGradleApply' because:
  Caching has not been enabled for the task
Task ':spotlessGroovyGradleApply' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
:spotlessGroovyGradleApply (Thread[Execution worker for ':',5,main]) completed. Took 0.001 secs.
:spotlessJava (Thread[Execution worker for ':',5,main]) started.

> Task :spotlessJava UP-TO-DATE
file or directory '/Users/xxx/Documents/git/aaaaaa/src/integrationTest/java', not found
file or directory '/Users/xxx/Documents/git/aaaaaa/src/main/groovy', not found
file or directory '/Users/xxx/Documents/git/aaaaaa/src/test/java', not found
file or directory '/Users/xxx/Documents/git/aaaaaa/src/integrationTest/java', not found
file or directory '/Users/xxx/Documents/git/aaaaaa/src/main/groovy', not found
file or directory '/Users/xxx/Documents/git/aaaaaa/src/test/java', not found
Applying dependency management to configuration 'spotless-511689954' in project 'aaaaaa'
Excluding []
Applying dependency management to configuration 'spotless865453420' in project 'aaaaaa'
Excluding []
Build cache key for task ':spotlessJava' is a01051c84e18f834b3abe35f4910d4bc
Skipping task ':spotlessJava' as it is up-to-date.
:spotlessJava (Thread[Execution worker for ':',5,main]) completed. Took 0.112 secs.
:spotlessJavaApply (Thread[Execution worker for ':',5,main]) started.

> Task :spotlessJavaApply UP-TO-DATE
Caching disabled for task ':spotlessJavaApply' because:
  Caching has not been enabled for the task
Task ':spotlessJavaApply' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
:spotlessJavaApply (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:spotlessMisc (Thread[Execution worker for ':',5,main]) started.

> Task :spotlessMisc
Build cache key for task ':spotlessMisc' is b22b275c0a8188754b53b743bb0b36e9
Task ':spotlessMisc' is not up-to-date because:
  Input property 'target' file /Users/xxx/Documents/git/aaaaaa/gradle/allprojects.gradle has changed.
Stored cache entry for task ':spotlessMisc' with cache key b22b275c0a8188754b53b743bb0b36e9
:spotlessMisc (Thread[Execution worker for ':',5,main]) completed. Took 0.111 secs.
:spotlessMiscApply (Thread[Execution worker for ':',5,main]) started.

> Task :spotlessMiscApply
Caching disabled for task ':spotlessMiscApply' because:
  Caching has not been enabled for the task
Task ':spotlessMiscApply' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
:spotlessMiscApply (Thread[Execution worker for ':',5,main]) completed. Took 0.001 secs.
:spotlessXml (Thread[Execution worker for ':',5,main]) started.

> Task :spotlessXml
Build cache key for task ':spotlessXml' is fae89173f4dc872e8400a4fdafa897f0
Task ':spotlessXml' is not up-to-date because:
  Input property 'target' file /Users/xxx/Documents/git/aaaaaa/.idea/workspace.xml has changed.
Stored cache entry for task ':spotlessXml' with cache key fae89173f4dc872e8400a4fdafa897f0
:spotlessXml (Thread[Execution worker for ':',5,main]) completed. Took 0.029 secs.
:spotlessXmlApply (Thread[Execution worker for ':',5,main]) started.

> Task :spotlessXmlApply
Caching disabled for task ':spotlessXmlApply' because:
  Caching has not been enabled for the task
Task ':spotlessXmlApply' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
:spotlessXmlApply (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:spotlessApply (Thread[Execution worker for ':',5,main]) started.

> Task :spotlessApply
Skipping task ':spotlessApply' as it has no actions.
:spotlessApply (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:autoLintGradle (Thread[Execution worker for ':',5,main]) started.

> Task :autoLintGradle
Caching disabled for task ':autoLintGradle' because:
  Caching has not been enabled for the task
Task ':autoLintGradle' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
:autoLintGradle (Thread[Execution worker for ':',5,main]) completed. Took 0.293 secs.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 7s
12 actionable tasks: 6 executed, 6 up-to-date
Watched directory hierarchies: [/Users/xxx/Documents/git/aaaaaa]
➜  aaaaaa git:(main) ✗ 

If you're just submitting a feature request or question, no need for the above.

rhoughton-pivot commented 2 years ago

Apache Geode is seeing a similar warning when using Spotless on groovyGradle types:

  groovyGradle {
    target project.fileTree(project.projectDir) {
      include '**/*.gradle'
      exclude '**/generated-src/**'
      exclude '**/build/**'
    }
    greclipse()

yields:

Errors occurred while build effective model from ~/.gradle/caches/modules-2/files-2.1/org.eclipse.platform/org.eclipse.swt/3.119.0/c5dde86661050197de73252c86bfe81676deca18/org.eclipse.swt-3.119.0.pom:
    'dependencies.dependency.artifactId' for org.eclipse.platform:org.eclipse.swt.${osgi.platform}:jar with value 'org.eclipse.swt.${osgi.platform}' does not match a valid id pattern. in org.eclipse.platform:org.eclipse.swt:3.119.0
carhartl commented 2 years ago

Maybe that helps with the investigation - the error starts appearing after 4.6.3... using greclipse("4.6.3") I can run spotless without error.

snicoll commented 1 year ago

@carhartl Trying to embed spotless in a lib that has to format Groovy. I've tried to set that version but I got:

Caused by: java.lang.IllegalArgumentException: 4.8 is the oldest version we support, this was 4.6
    at com.diffplug.spotless.extra.groovy.GrEclipseFormatterStep$1.model(GrEclipseFormatterStep.java:50)
    at com.diffplug.spotless.extra.EquoBasedStepBuilder.createModelWithMirrors(EquoBasedStepBuilder.java:126)
    at com.diffplug.spotless.extra.EquoBasedStepBuilder.get(EquoBasedStepBuilder.java:107)
    ... 76 more
joseeliaschavez commented 8 months ago

Maybe that helps with the investigation - the error starts appearing after 4.6.3... using greclipse("4.6.3") I can run spotless without error.

I tried this but getting the following error Gradle v8.6 Spotless Plugin v 6.25.0

* What went wrong:
Could not determine the dependencies of task ':spotlessApply'.
> Could not create task ':spotlessGroovyApply'.
   > Could not create task ':spotlessGroovy'.
      > java.io.IOException: Failed to load eclipse groovy formatter: java.lang.NumberFormatException: For input string: "6.3"
yashanand0909 commented 8 months ago

I started getting below error when I moved from spotless version 5.17.1 to 6.0.1 on gradle 8.5. I am trying to use predeclareDepsFromBuildscript to get the old behavior but that's not working as well.

dependencies.dependency.artifactId' for org.eclipse.platform:org.eclipse.swt.${osgi.platform}:jar with value 'org.eclipse.swt.${osgi.platform}' does not match a valid id pattern. in org.eclipse.platform:org.eclipse.swt:3.125.0