Blogs

Blogs

Blade Project Version

How Updating Blade Can Give You A Headache...

TL;DR - Add "-v 7.0" to your Blade command line to create modules for Liferay CE 7.0 and Liferay DXP 7.0.

Hey, just a quick blog post here for something that developers may need to know...

I updated my Blade command line tool recently (since I use Intellij, I rely on the command line tool quite a bit for new module project creation), but I hadn't started a new module after updating.

That changed last Friday... Had a hot customer request for a customization so I used Blade to create a new workspace and started creating my modules. Modules loaded into Intellij just fine, and I happily start cranking out the code.

When I was happy with development, I built my 3 modules (SB API and Service modules and one UI module) and dropped them into my Liferay 7.0 DXP deployment folder.

Normally, I see the happy messages that my modules have started. I mean, these modules were not rocket science and they had no weird transitive dependency issues, so they should have just started.

But none of them did, not even the API module and those never have an issue starting.

So I fire up the Gogo shell, issue my lb command, and there are my modules at the end of the list, all in the Installed state.

So I command Gogo to start my API module, but it won't start, it has unresolved references on portal-kernel 3.0 and other such references.

I realize right away that portal-kernel 3.0 is from Liferay 7.1, but I wasn't building anything for Liferay 7.1, I'm still building for 7.0.

All of my modules suffered from the same problem, all had references to 7.1 artifacts.

Not knowing any better, I went back into the build.gradle files for my 3 modules and updated all of the versions so they were back at the normal 7.0 versions, rebuilt and redeployed and all was good.

So I asked my friend Greg Amerson what the deal was, and he informed me that the new default project version for the Blade tool is now 7.1. To have Blade create a project for Liferay CE 7.0 or Liferay DXP 7.0, you have to add "-v 7.0" to the Blade command line arguments.

So, there you go.  Avoid my Blade update headaches and just remember to tack on the "-v 7.0" for all of your new 7.0 modules.

Update 08/2018

So I checked with the folks that know, unfortunately there is no way to "default" the new blade to 7.0.  There are plans on the roadmap, but I don't know what that means for when it is available.

In the mean time, if you are using and developing for Liferay CE 7.0 or Liferay DXP 7.0, don't upgrade your blade until you move to 7.1 or they get the default setting in place.

If you did upgrade your blade, you can either remember to add the -v 7.0 args to your invoke of blade, or the easier option might be to just revert to an older version of Blade.

All you need to do is:

  1. jpm remove blade
  2. jpm install -f https://releases.liferay.com/tools/blade-cli/3.1.0.201807032155/blade.jar

That should get you back to a pre-7.1 version where the default will be 7.0.