How do I keep IntelliJ from deploying an artifact twice?

Answered

I have an EAR project (build using Maven) that I deploy in IntelliJ (usually using debug but sometime Run) to a WebLogic server. When I hit debug, the EAR deploys fine BUT it takes a very long time. It takes a long time anyway, but I see the same log messages scrolling past twice. I'm not sure but I suspect that the artifact is actually already deployed and when WebLogic starts, it deploys as part of the start up and THEN IntelliJ re-deploys it.

Is there any way that I can fix this?

 

Thanks!

1
3 comments

Configure the server so that it doesn't deploy anything on start. Start the server outside of IntelliJ IDEA to verify that nothing is deployed.

0
Avatar
Permanently deleted user

There is something deployed. It's the same EAR that IntelliJ deployed the last time I started it (that's the only way that anything has been deployed there). Is it possible that IntelliJ doesn't undeploy when the application shuts down?

0

I have a solution to prevent deploy twice with weblogic server in IntelliJ IDEA.  As following steps:

1. Assume your config file path is /home/elva/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain/config/config.xml.

Copy the config.xml as config.xml.bak and edit the new file, you mayby find app-deployment  node in the file, delete the node.

2. create a shell script, content is as following:

config=/home/elva/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain/config/config.xml
configOld=/home/elva/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain/config/config.xml.bak
cp $configOld $config

3. Edit the debug Configuration, find "Before launch" panel, there already exists two task: Build  and Build xxx artifact. Click the plus button to add a new task, choose execute external tool, select the shell script in step 1.

4. You can run debug the project now.

FAQ:

1. While debug, throws errors like can't init the dataSource. Because the config.xml stores the jdbc infomation, you  should at first debug the project and config the dataSource infomation, then try the steps up to create config.xml.bak

0

Please sign in to leave a comment.