bancolombia / scaffold-clean-architecture

Gradle plugin to create a clean application in Java that already works, It follows our best practices!
Apache License 2.0
416 stars 151 forks source link

No se puede ejecutar el jar generado #465

Closed enterpreneur369 closed 2 months ago

enterpreneur369 commented 2 months ago

Is your feature request related to a problem? Please describe. Cuando se usa el comando gradle clean build cuando se intenta ejecutar el jar directamente con el comando java -jar archivo

Este no funciona y revisando el manifest indica que no tiene una clase main.

Describe the solution you'd like Me gustaría poder ejecutar el artefacto jar directamente desde la consola, no solo desde el ide.

Describe alternatives you've considered He intentado agregar lineas relacionadas con el manifest en el build.gradle de la página principal También hago el proceso normal que es un gradlew clean build desde el mismo bat que está en el proyecto. luego ejecuto el java -jar /carpeta/libs/card.jar pero me da error de que no encuentra el manifest.

Additional context Estoy usando java 21

juancgalvis commented 2 months ago

Hi @enterpreneur369

I think you have a mistake with executable path:

For example if your project root is in the folder sample

the bootable jar is in: sample/applications/app-service/build/libs/sample.jar

The external jar localted at sample/build/libs/sample.jar is not a bootable application.

Please follow the next commands and tell us if this works or share with us the error with complete step sequence execution.

mkdir sample
cd sample
echo "plugins {
    id \"co.com.bancolombia.cleanArchitecture\" version \"3.17.11\"
}" > build.gradle
gradle ca --javaVersion VERSION_21 --name sample
gradle gep --type webflux
gradle build
ls applications/app-service/build/libs

java -jar applications/app-service/build/libs/sample.jar # your desired execution, which should be the default...

My output of the jar execution is:

➜  sample java -jar applications/app-service/build/libs/sample.jar

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.3.1)

2024-06-27T15:02:52.969-05:00  INFO 27535 --- [sample] [           main] co.com.bancolombia.MainApplication       : Starting MainApplication using Java 21.0.3 with PID 27535 (/Users/username/projects/sample/applications/app-service/build/libs/sample.jar started by username in /Users/username/projects/sample)
2024-06-27T15:02:52.971-05:00  INFO 27535 --- [sample] [           main] co.com.bancolombia.MainApplication       : No active profile set, falling back to 1 default profile: "default"
2024-06-27T15:02:53.010-05:00  INFO 27535 --- [sample] [           main] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2024-06-27T15:02:53.622-05:00  INFO 27535 --- [sample] [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoints beneath base path '/actuator'
2024-06-27T15:02:53.809-05:00  INFO 27535 --- [sample] [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port 8080 (http)
2024-06-27T15:02:53.816-05:00  INFO 27535 --- [sample] [           main] co.com.bancolombia.MainApplication       : Started MainApplication in 1.083 seconds (process running for 1.352)
enterpreneur369 commented 2 months ago

Ohh yes you are all right I changed the folder by card-service\applications\app-service\build\libs and this jar works, thank you so much.