Steps to reproduce:
- Go into any existing module that gets deployed with Liferay's gradle scripts
- Run mkdir docroot
- Try to deploy it
- Result: The deploy script completes successfully, and the Liferay logs say the bundle started, but the running module has no content.
The only indication you get that something is wrong is this line in the gradle output:
and then when you connect to gogo shell, your bundle isn't running anything.
If you dig in further, you'll find that not only does gradlew jar produce an empty jar, but gradlew compileJava doesn't even produce any class files.
Obviously mkdir docroot is a contrived example, but this happens whenever you try to convert an existing WAB-style module into a more kosher OSGi-style module. This has happened to me multiple times, but it took me almost a half hour just now to realize that this was my problem because the signs are so ambiguous.
What makes this so hard to diagnose is git status doesn't show empty directories, and neither does find -type f (obviously, because of the flag, but I use this very often as the directories usually just add noise). I was comparing a working module with the broken one and they were exactly the same – how could it not be working? Oh, because there's this empty directory in the broken one that none of the commands I was using were showing me.
Hopefully I've included enough detail here for some other poor developer experiencing the same thing to find the solution. (If you're experiencing this, just delete the docroot directory and your problems should go away.)
I'd really like to see this fixed, where only a docroot directory that actually has files in it is used as a flag to run all the gradle scripts differently – or, even better, gradle outputs something whenever it sees a docroot directory saying that it's treating the module as a WAB, and if that's not what you want it to do, delete or rename your docroot directory.