vaadin / archetypes

Archetypes for Vaadin platform
https://vaadin.com
4 stars 7 forks source link

PiT 24.4: project does not work either in dev and prod modes #208

Closed manolo closed 8 months ago

manolo commented 8 months ago
  1. create a new project
    
    mvn -ntp -q -B archetype:generate -DarchetypeGroupId=com.vaadin \
    -DarchetypeArtifactId=vaadin-archetype-spring-application \
    -DarchetypeVersion=LATEST \
    -DgroupId=com.vaadin.starter -DartifactId=archetype-spring

cd archetype-spring

2. update `vaadin.version` to `24.4.0.alpha3`
3. add prereleases repository 
vhttps://maven.vaadin.com/vaadin-prereleases

pluginRepository>vhttps://maven.vaadin.com/vaadin-prereleases

4. run the project in dev-mode and see the error

mvn

... No plugin found for prefix 'vaadin' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/manolo/.m2/repository), v (https://maven.vaadin.com/vaadin-prereleases), central (https://repo.maven.apache.org/maven2)]


5. package the project for production and see the error

mvn package -Pproduction

... archetype-spring: Could not execute build-frontend goal: Failed to configure Hilla engine: Command failed with exit code 1: mvn -> [Help 1]

Artur- commented 8 months ago

There is no plugin defined in pom.xml and Hilla seems to assume there will be

mcollovati commented 8 months ago

https://github.com/vaadin/hilla/pull/2031 seems to fix the issue. An error message is shown on the console, but the run and the build succeed

2024-02-08T14:37:31.421+02:00  INFO 66232 --- [  restartedMain] c.v.f.s.DefaultDeploymentConfiguration   : 
Vaadin is running in DEVELOPMENT mode - do not use for production deployments.
2024-02-08T14:37:31.468+02:00  INFO 66232 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port 8080 (http) with context path ''
2024-02-08T14:37:31.474+02:00  INFO 66232 --- [  restartedMain] com.vaadin.starter.Application           : Started Application in 4.738 seconds (process running for 5.024)
2024-02-08T14:37:31.792+02:00  INFO 66232 --- [onPool-worker-1] c.v.f.s.frontend.TaskUpdatePackages      : using '/xxxx/.nvm/versions/node/v18.12.1/bin/npm --no-update-notifier --no-audit --scripts-prepend-node-path=true --ignore-scripts install' for frontend package installation
2024-02-08T14:37:45.191+02:00  INFO 66232 --- [onPool-worker-1] c.v.f.s.frontend.TaskUpdatePackages      : Frontend dependencies resolved successfully.
[ERROR] No plugin found for prefix 'vaadin' in the current project and in the plugin groups [org.sonatype.plugins, org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/xxxx/.m2/repository), v (https://maven.vaadin.com/vaadin-prereleases), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException
2024-02-08T14:37:50.883+02:00  INFO 66232 --- [onPool-worker-1] com.vaadin.hilla.parser.core.Parser      : Search for endpoints in directories [/xxxxx/archetype-spring/target/classes]
2024-02-08T14:37:51.881+02:00  INFO 66232 --- [   File Watcher] rtingClassPathChangeChangedEventListener : Restarting due to 1 class path change (1 addition, 0 deletions, 0 modifications)
 __  __             _                  
|  \/  | _   _     / \    _ __   _ __  
| |\/| || | | |   / _ \  | '_ \ | '_ \ 
| |  | || |_| |  / ___ \ | |_) || |_) |
|_|  |_| \__, | /_/   \_\| .__/ | .__/ 
         |___/           |_|    |_|    

2024-02-08T14:37:51.934+02:00  INFO 66232 --- [  restartedMain] com.vaadin.starter.Application           : Starting Application using Java 17.0.7 with PID 66232 (/xxxxx/archetype-spring/target/classes started by xxxx in /xxxxx/archetype-spring)
2024-02-08T14:37:51.934+02:00  INFO 66232 --- [  restartedMain] com.vaadin.starter.Application           : No active profile set, falling back to 1 default profile: "default"
2024-02-08T14:37:52.059+02:00  INFO 66232 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8080 (http)
2024-02-08T14:37:52.059+02:00  INFO 66232 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-02-08T14:37:52.060+02:00  INFO 66232 --- [  restartedMain] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.17]
2024-02-08T14:37:52.067+02:00  INFO 66232 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-02-08T14:37:52.067+02:00  INFO 66232 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 132 ms
2024-02-08T14:37:52.085+02:00  INFO 66232 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing AtmosphereFramework
2024-02-08T14:37:52.111+02:00  INFO 66232 --- [  restartedMain] c.v.f.s.VaadinServletContextInitializer  : Search for subclasses and classes with annotations took 0 ms
2024-02-08T14:37:52.118+02:00  INFO 66232 --- [  restartedMain] c.v.b.d.startup.DevModeStartupListener   : Starting dev-mode updaters in /xxxxx/archetype-spring folder.
mcollovati commented 8 months ago

The maven error is likely because the ProcessBuilder used to execute the command is using the default Redirect.PIPE. The maven command has the -q option, but this does not prevent writing on STDERR. A dirty workaround to suppress it could be to also set the --log some-temporary-file.log option.

A better option could be to configure the process builder to not redirect streams to the current Java process.

mcollovati commented 8 months ago

Actually, CommandRunner redirects STDOUT and STDERR using Redirect.INHERIT strategy when executing the command and the default Redirect.PIPE when testing if the tool exists (e.g. ./mvnw or mvn).

So, the output of the tool testing operation is not processed and does not end on the console, whereas outputs of the command are directly printed on STDOUT and STDERR of the main process.

manolo commented 8 months ago

Tested in latest alpha an it works as expected, closing.