Open ggecy opened 1 month ago
I used to run into the same problem and fixed it putting the command line arguments (-Dmaven.repo.local=../mvnRepository
) into the MAVEN_ARGS
environment variable in my pipeline.
I used to run into the same problem and fixed it putting the command line arguments (
-Dmaven.repo.local=../mvnRepository
) into theMAVEN_ARGS
environment variable in my pipeline.
Thanks, that kind of works, but in jenkins pipeline we are using configFileProvider
for maven settings.xml
, which is stored in temporary file with path to file set to environment variable MAVEN_SETTINGS_XML
inside steps
in stage
. I can setup the MAVEN_ARGS
variable in environment
block in jenkins pipeline but I cannot use the -s $MAVEN_SETTINGS_XML
there since that variable is comming from configFileProvider and it isn't expanded when I put it in MAVEN_ARGS
variable.
Well, it works when I set the -Dmaven.repo.local=../mvnRepository
in MAVEN_ARGS
and set the -s $MAVEN_SETTINGS_XML
individually for each mvn
command, but it means that settings.xml
is not passed to child process mvn command, which in our case shouldn't be a problem, however you have an option to specify localRepository
also inside settings.xml
.
Update: In the end I had to change the configFileProvider
to save the settings.xml
to jenkins pipeline root folder and added it to MAVEN_ARGS
as absolute path (actually all paths in MAVEN_ARGS
have to be absolute since mvn vaadin:configure
run by vaadin plugin is started in different working directory so the relative paths doesn't work), it wasn't working without it.
Describe the bug
In Jenkins builds we have explicitly specified maven repository path via
-Dmaven.repo.local=../mvnRepository
mvn parameter, so each pipeline has its own local maven repo. If vaadin maven plugin determines that hilla is in project, it will runmvn vaadin:configure
command in separate child process, but it doesn't pass the path to local maven repository so it will use the default ~/.m2 folder and fail because it will not find the locally built dependencies there which were installed in the local repo by the pipeline build.To further make this a bigger problem, vaadin plugin calls
com.vaadin.hilla.internal.AbstractTaskEndpointGenerator#prepareEngineConfiguration
which doesn't even read the error output stream from the child processes it spawns so there is no direct way of knowing why the child process is failing on CI/CD while working fine locally without some time consuming investigation.Expected-behavior
If vaadin maven plugin runs any child processes with maven commands, it should pass all relevant configuration parameters so they works with same settings as the parent build process and doesn't cause the whole build to fail.
If there is any error in child processes the plugin should read at least the error stream of the child process and write it to build output so the use able to determine what is wrong.
Reproduction
mvn vaadin:configure
during maven build.mvn -Dmaven.repo.local=./mvnRepository clean install
System Info
MacOS 14.5, Vaadin 24.4.3