grails / grails-wrapper

Grails Wrapper
Apache License 2.0
2 stars 6 forks source link

Issues with 5.0.0 wrapper #22

Open codeconsole opened 4 days ago

codeconsole commented 4 days ago

Using https://github.com/grails/grails-wrapper/releases/tag/v5.0.0

Issues with Line Separator

% ./grailsw
env: bash\r: No such file or directory

this happens because the Line Separator used is different from the one in sdkman

It uses CRLF and should just be LF

Issues Resolving Test Dependencies

if I take grailsw from sdkman 5.3.6

% ./grailsw
| Resolving Dependencies. Please wait...

CONFIGURE SUCCESSFUL in 945ms
| Error Could not resolve all artifacts for configuration ':testRuntimeClasspath'. Type 'gradle dependencies' for more information

if I comment out all the test dependencies it works.

stop-app doesn't appear to work

grails> stop-app
2024-09-15T23:02:08.687-04:00  WARN 40822 --- [nio-8081-exec-2] o.s.web.servlet.PageNotFound             : No mapping for POST /actuator/shutdown
2024-09-15T23:02:08.688-04:00  WARN 40822 --- [nio-8081-exec-2] o.s.web.servlet.PageNotFound             : No endpoint POST /actuator/shutdown.
| Error Application not running. (Use --stacktrace to see the full trace)
codeconsole commented 4 days ago

Adding the following to application.yml resolves stop-app but results in new unwanted behavior is Java 21

grails> stop-app
2024-09-15T23:08:38.955-04:00  INFO 41394 --- [      Thread-12] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2024-09-15T23:08:38.956-04:00  INFO 41394 --- [      Thread-12] o.a.c.c.C.[Tomcat].[localhost].[/]       : Destroying Spring FrameworkServlet 'dispatcherServletRegistration'
<=======<===========--> 85% EXECUTING [9s]
> :bootRun
grails> Error opening zip file or JAR manifest missing: ~/.sdkman/candidates/java/21.0.4-graal/lib/management-agent.jar

FAILURE: Build failed with an exception.
 % java -version
java version "21.0.4" 2024-07-16 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.4+8.1 (build 21.0.4+8-LTS-jvmci-23.1-b41)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.4+8.1 (build 21.0.4+8-LTS-jvmci-23.1-b41, mixed mode, sharing)

I don't think management-agent.jar has existed since Java 8. I think this is related to a bug with stop-app because if I run quit instead of stop-app it seems to shutdown using the same mechanism (the actuator), but shuts down fine.

==========--> 85% EXECUTING [12s]
grails> quit
| Application shutdown.
jamesfredley commented 3 days ago

@codeconsole Please verify that grailsw now has the correct line endings on https://github.com/grails/grails-wrapper/releases/tag/v5.0.0

codeconsole commented 3 days ago

@jamesfredley the wrapper now works and has the correct line endings. What caused it to be generated the previous way that did not work?

jamesfredley commented 3 days ago

It was copied from a Windows machine and my guess is that the line endings were changes during git clone. Those files have not changed since 2017: https://github.com/grails/grails-wrapper/tree/5.0.x/shell

jamesfredley commented 3 days ago

@codeconsole Did you have mavenCentral() in repositories{} and profile ("org.grails.profiles:web") in dependencies{} when the error occurred? If you run gradle assemble do you get the same error?

Error Could not resolve all artifacts for configuration ':testRuntimeClasspath'. Type 'gradle dependencies' for more information

codeconsole commented 3 days ago

@jamesfredley yes. I have those things. if I run gradle assemble, I get

Execution failed for task ':distTar'.
> Entry website-0.1/lib/jaxb-core-4.0.5.jar is a duplicate but no duplicate handling strategy has been set. Please refer to https://docs.gradle.org/8.10.1/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.

I figured out which test dependency is causing the failure. It is just one that causes the failure:

testImplementation("org.grails.plugins:geb")
codeconsole commented 3 days ago

Looks like the stop-app issue has already been reported

https://github.com/grails-profiles/base/issues/31

jamesfredley commented 2 days ago

@codeconsole the Error Could not resolve all artifacts for configuration ':testRuntimeClasspath'. Type 'gradle dependencies' for more information issue can be resolved with the following. grails-wrapper can only load on a project that will assemble. I suspect you will also have to do this for distZip, at a minimum.

    distTar {
        duplicatesStrategy = DuplicatesStrategy.INCLUDE
    }

Bigger picture, if that issue is going to occur on all projects, then it should be addressed globally. Possibly in:

https://github.com/grails/grails-core/blob/7.0.x/gradle/assemble.gradle#L85-L89

For stop-app, how do you want to approach it and do you want to take a swing at it? Having it call quitlooks like a potentially quick path, although it would exit grailsw, if it is running in interactive mode.

jamesfredley commented 1 day ago

https://github.com/grails/grails-core/pull/13648 - a WIP for duplicatesStrategy at a higher level

codeconsole commented 1 day ago

@jamesfredley how is testImplementation("org.grails.plugins:geb") causing this in the first place? and how would adding a duplicatesStrategy do a distribution affect/fix something specific to the test environment?

jamesfredley commented 1 day ago

I do not know why, but with Gradle 8 this is occurring more often.