Eclipse removes files / folders from deployment path during build

I have two maven projects in eclipse webapp and serviceImpl . webapp links serviceImpl .

When the serviceImpl project serviceImpl closed in eclipse and I build and run the webapp on Tomcat, the application works fine. But when I run webapp while serviceImpl open, I get an error that HTTP Status 500 - Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/serviceimpl-context.xml] . If I look in the META-INF folder on the machine, I see that eclipse has deleted the xml file.

When I create and run the application on the command line or in IntelliJ, the problem also does not occur.

In eclipse, the Deployment Assembly webapp settings contain an open serviceImpl project and source links to some serviceImpl-2.0.0-SNAPSHOT.jar .

Also Java Build Path โ†’ Libraries โ†’ Maven Dependencies has a serviceImpl node:

enter image description here

We also use Spring Application Context.

EDIT:

When I do on the command line:

mvn clean install -P build-modules-test -Dmaven.test.skip=true

then an xml file is created and the application works fine. But in eclipse, "right-click the project -> Maven -> Update project" deletes these files, but does not create them again ... therefore an error occurs

+5
source share
1 answer

As I already noted, the โ€œupgrade projectโ€ does not match mvn install : files are created during the package phase, a phase that is not called during the Eclipse update.

See " Development with Eclipse and Maven / Running Maven Builds "

Define the launch setup with all the necessary parameters:

https://books.sonatype.com/m2eclipse-book/reference/figs/web/running_run-config.png

Then you are sure to follow the same steps as on the command line through mvn install .

+2
source

Source: https://habr.com/ru/post/1273994/


All Articles