Open bmarwell opened 4 years ago
I would have solved the problem here by doing:
mvn liberty:create dependency:copy@goal liberty:dev.
Then dev mode won't install over target/liberty/wlp/ since it's already there.
It can also be nice to use a separate WLP_USER_DIR but it's not always clean, maybe you don't have write access. It's nice to use the maven build dir too.
Thanks, didn't even think of liberty:create as it was already included in liberty:dev. Good catch!
I agree, I really like to have a separate WLP_USER_DIR, but it really should stay inside ${project.build.directory}
. Actually I had a typo and meant ${project.build.directory}/wlp-usr/
.
Hi Andy,
as you probably have noticed on twitter, there currently seems to be no elegant way to supply shared resources to the
liberty:dev
maven goal. So I thought you might want to add how to do this?Expected outcome
Use a library from the
${shared.resource.dir}
.Relevant part from
src/main/liberty/config/server.xml
:Hassle with the liberty-maven-plugin
liberty:dev
currently does not support copying artefacts to the${shared.resource.dir}
itself. That's okay, the liberty-maven-plugin should probably only manage liberty.But there is a caveat:
Suppose you execute
mvn dependency:copy@goal liberty:dev
.${project.output.directory}/liberty/wlp/usr/share/resources/h2/
as expected.liberty:dev
will delete the directory${project.output.directory}/liberty/wlp
and unzip a fresh copy of liberty. The h2 library is gone, the server will not start. Also, there is no option to have the liberty-maven-plugin not clean up the folder beforehand.mvn dependency:copy@goal liberty:dev
(without clean!), it works fine -- but that is not a reliable nor desirable solution.Working solution
So I came up with this configuration in my
pom.xml
which redefineswlp.usr.dir
/WLP_USR_DIR
. I think this could possible be added to the cheat sheet.Maybe this solution can be added to the examples? I figured out having
wlp.usr.dir
(or envWLP_USR_DIR
in a subdirectory of a liberty installation is (almost) never a good idea. I have a few (open)liberty versions on my machines, and I use the same WLP_USR_DIR for all of them.