grails-core icon indicating copy to clipboard operation
grails-core copied to clipboard

Distribution fails to run on Windows

Open matrei opened this issue 1 year ago • 1 comments

Expected Behavior

.\gradlew assemble
unzip .\build\distribrutions\grails-7.0.0-SNAPSHOT.zip
.\build\distributions\grails-7.0.0-SNAPSHOT\bin\grails -version
| Grails Version: 7.0.0-SNAPSHOT
| JVM Version: 17.0.12

Actual Behaviour

.\gradlew assemble
unzip .\build\distribrutions\grails-7.0.0-SNAPSHOT.zip
.\build\distributions\grails-7.0.0-SNAPSHOT\bin\grails -version

Exception: java.lang.NoSuchMethodError thrown from the UncaughtExceptionHandler in thread "main"

Steps To Reproduce

No response

Environment Information

  • Operating system: Windows 11
  • JDK Version: OpenJDK 64-Bit Server VM Temurin-17.0.12+7 (build 17.0.12+7, mixed mode, sharing)

Example Application

No response

Version

7.0.0-SNAPSHOT

matrei avatar Oct 16 '24 19:10 matrei

more details: https://github.com/grails/grails-core/pull/13740#issuecomment-2411792238

jamesfredley avatar Oct 16 '24 19:10 jamesfredley

This may have been resolved by https://github.com/grails/grails-core/pull/13801, but testing it is blocked by https://github.com/grails/grails-core/issues/13816

jamesfredley avatar Nov 01 '24 19:11 jamesfredley

https://github.com/grails/grails-core/issues/13816 and https://github.com/grails/grails-core/pull/13801 got us past the initial issues.

now need to have org.gradle:gradle-tooling-api in the distribution

grails
Error: Unable to initialize main class org.grails.cli.GrailsCli
Caused by: java.lang.NoClassDefFoundError: org/gradle/tooling/BuildCancelledException

https://github.com/grails/grails-core/pull/13762/files set it to compileOnly so that the extra gradle repo was not needed in every project.

jamesfredley avatar Nov 07 '24 00:11 jamesfredley

https://github.com/grails/grails-core/pull/13919 gets us past Unable to initialize main class org.grails.cli.GrailsCli

jamesfredley avatar Dec 14 '24 17:12 jamesfredley

https://github.com/grails/grails-core/pull/13919#issuecomment-2538862741

But when running grails it chokes on another problem:

$ ./grails-7.0.0-SNAPSHOT/bin/grails --stacktrace
| Error Error occurred running Grails CLI: Could not find artifact org.grails.profiles:angular:jar:${profiles-angular.version} in grailsCentral (https://repo.grails.org/grails/core) (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.grails.profiles:angular:jar:${profiles-angular.version} in grailsCentral (https://repo.grails.org/grails/core)
        at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:42)
        at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:417)
        at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:260)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:537)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:449)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:261)
        at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:353)
        at org.grails.cli.compiler.grape.MavenResolverGrapeEngine.resolve(MavenResolverGrapeEngine.java:292)
        at org.grails.cli.compiler.grape.MavenResolverGrapeEngine.grab(MavenResolverGrapeEngine.java:115)
        at org.grails.cli.compiler.grape.MavenResolverGrapeEngine.grab(MavenResolverGrapeEngine.java:107)
        at org.grails.cli.profile.repository.MavenProfileRepository.getAllProfiles(MavenProfileRepository.groovy:135)
        at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:240)
        at org.grails.cli.GrailsCli.main(GrailsCli.groovy:160)
| Error Error occurred running Grails CLI: Could not find artifact org.grails.profiles:angular:jar:${profiles-angular.version} in grailsCentral (https://repo.grails.org/grails/core)

It seems the bom version variables are not resolved.

jamesfredley avatar Dec 14 '24 18:12 jamesfredley

@jamesfredley is it how it is trying to resolve it? Should it use something similar to this since it is not camelCase?

${project['profiles-angular.version']}"

codeconsole avatar Dec 29 '24 05:12 codeconsole

https://repo.grails.org/ui/repos/tree/PomView/libs-snapshots-local/org/grails/grails-bom/7.0.0-SNAPSHOT/grails-bom-7.0.0-20241229.020850-191.pom

${profiles-angular.version} was coming from grails-bom and org.grails.cli.boot.GrailsDependencyVersions needed to be updated to handle version lookup

<properties>
     <profiles-angular.version>10.0.1</profiles-angular.versio>
</properties>
<dependencyManagement>
     <dependencies>
          <dependency>
               <groupId>org.grails.profiles</groupId>
               <artifactId>angular</artifactId>
               <version>${profiles-angular.version}</version>
          </dependency>
     </dependencies>
</dependencyManagement>

jamesfredley avatar Dec 31 '24 02:12 jamesfredley