Recommended way to find out what Liferay module provides a class - liferay

In my Liferay module, I want to use Liferay's SomeConvenientClass.
What is the recommended way to find out what module provides that class?
So that I can quickly add it to my build.gradle.
Ideally it should either:
return the module's group/name/version,
or say with certitude that this class does not exist in Liferay or is not exported.
Until now I go by trial-and-error and copy/paste from build.gradle files found in the wild, but I am looking for a more reliable method.
I have Liferay installed, and the source code of the exact same Liferay version, if that helps.
I tried mvnrepository but it does not seem to return anything, example: https://mvnrepository.com/search?q=AuditMessageProcessor

Have you tried http://search.maven.org/#advancedsearch ?
For example:
http://search.maven.org/#search|ga|1|c:"AuditMessageProcessor"

This is more an option than a real thing, but this is how I normally do:
be familiar with package naming conventions used by liferay and
inside apps: api, service, web...
be familiar with the bundle structure used by liferay, as their
use of resource folders, which are not so obvious sometimes...
With that in mind, normally on github is enough to navigate: portal->(kernel/impl/services/apps)->app service/api/web...
But this is a natural process that comes when you spend your day inside the code.
Normally, online jar locators help, but quite often I just rely on my IDE.
On my IDE I have all set-up with Spring dependency management, after I extracted the dependencies using Gogo shell with a running bundle. With Gogo you will not find classes, but modules and packs will be listed. (Gogo is probably what you are looking for btw, as it is able to list with version numbers)
Bottom line, if you need a list as a picture of a running environment, use Gogo.
With regards to the master code, just do not trust it! When it comes to modularity and bundles versioning Liferay is pretty messy (read The dependency management problem here: https://www.e-systems.tech/blog/-/blogs/liferay-digital-experience-platform-review-7-0-ga4).
For your step 7, you will need to chose an api version and code against it. The apis are more stable. You can impose a limit for compatibility on you bnd file, which will cause the system to issue warnings. On your environment, you can catch api changes earlier, let's say, you can ask gradle to use a module with an version number but any patch (using the "+" sing), when you build with a fresh cache or if you change gradle resolution strategy to download you dependencies more frequently, if the build breaks, well, you will see it.
Helpful start point: https://dev.liferay.com/pt/develop/reference/-/knowledge_base/7-0/using-the-felix-gogo-shell

This is how I do, it is slow and manual, so don't hesitate to suggest other methods.
Download Liferay's source code if you don't have it already.
Run find . -name SomeConvenientClass.java. If nothing is found, you can be sure the class is not part of Liferay.
In the path to the class, find the src folder level, and go just under that, so for instance if it is modules/apps/collaboration/document-library/document-library-web/src/main/java/com/liferay/document/library/web/portlet/action/DLViewMVCRenderCommand.java then go to modules/apps/collaboration/document-library/document-library-web/.
Hopefully there is a bnd.bnd file there, open it.
If the package of the class is not in the Export-Package section, then either give up (duplicate Liferay's code into your module), or use some dark tricks. If you believe the class should be exported, you can explain your case at https://issues.liferay.com/browse/LPS-70480 for future generations to enjoy.
Module name is the value of Bundle-SymbolicName.
Version is the value of Bundle-Version.
Group is probably com.liferay, although sometimes it is com.liferay.portal, not sure how to tell.
Build. Sometimes it fails because Maven repositories are missing a version, for instance com.liferay.document.library.web 1.0.11 is not available despite being used by DXP fix pack 30. Not sure what to do in such cases except choosing a "similar" version and hoping for the best.

Related

Write custom grid layouts with extbase/fluid but without any extension like gridelements

I look for a tutorial, help or an example that tells me what I have to do to write a grid element like 2-colums in basic typo3 (v9) with fluid but no other extension like gridelements, DCE, Templa Voila, etc. I want the same gridelements can do but I dont want to be depended to this extention and move it in my own site extention.
I tried the same with normal content elements (CE) like here:
https://docs.typo3.org/c/typo3/cms-fluid-styled-content/9.5/en-us/AddingYourOwnContentElements/Index.html
But how can I nest a CE in a CE? And how can I do this by drag&drop in the backend?
You can't. The page module doesn't support nesting
You can't nest CEs in a CE. On database level this would mean that you have to make a tt_content record a subrecord of a parent tt_content record. You run into several problems, basically the multilanguage support will be broken and the shortcut element does not function as you will expect it to. That is why the extensions "gridelements" and "mask" exist.
I integrated the gridelements configuration into my sitepackage. So I do not need to bother anymore with it.
Just for your info:
There is now an initiative that works on integrating this functionality into the core (Structured Content Initiative, https://typo3.org/article/a-structured-content-initiative/). Stay tuned to it.
There is nothing special about providing Gridelements via external files, since it's based on TSconfig, TypoScript and Fluid. That's why there is not that much about it in the documentation, since it's the same thing you would do with any other kind of sitepackage. The TSconfig and TypoScript parameters are already explained there, while the Fluid would be up to you anyway.
To have a kind of kickstarter just take any extensions providing Gridelements layouts as an example. A very popular one would be bootstrap_grids, which can be found in the TER or here: https://github.com/laxap/bootstrap_grids
You don't necessarily need the flexform controller of that extension, but the Configuration and Resources folders, show you how to configure stuff and you can see how that is included via ext_localconf.php
There are even comments i.e. in the TSconfig files to explain what is possible there and how to handle i.e. mixed environments with record and file based setups. Although it would be recommended to go for files.
You would at least have to add the necessary backend rendering methods to a draw item hook, that will modify the preview of the container element.
So basically you would have to rewrite everything that DCE, Flux, Gridelements or other similar extensions already do.
Which brings us to the question, why you want to avoid those extensions, since especially those three are well known, widely spread, well supported and available for currently supported TYPO3 versions.

How to make bit ignore a dependency file?

We have a current ReactJS project and we build a custom grid, input, error handler, etc for it.
now we start a new project and we want to share our components code between projects. we do some research and find bit platform bitsrc.io
so pleasant and good and we actually share some code between our projects with it.
the only problem is bit has a dependency checker for the import statement.
we add most of the dependency to bit lifeCycle but some of them is a config file and we want them to be different in our projects.
can anyone know the way we could ignore config import dependency to the bit?
//make bit ignore this file in dependency checking
import GeneralConfig from 'Modules/GeneralConfig/GeneralConfig'
Generally speaking, if you ignore a dependency in bit, the component will not be truly reusable. This is becasue other projects may lack a dependency for the component to function.
To ignore a missing dependency, use the --ignore-missing-dependencies for the bit tag command.
What I suggest is for you to inject the configuration to the component, rather than having the component depending on the configuration.

Errors when running Language-Solution in MPS

I'm developing an DSL with jetbrains MPS. It's not obvious to use, but I succeeded so far with the design-part.
It's possible to right-click on a solutions node and "run" it, assuming the language is executable (extends executing.util). Plus I use a seperately developed jar as a library (used by the generator).
I build a new project to test, as simple as possible, added some extra nodes and loops in the generator, the error occures and it can't be undone.
As far as I can see, there are several possible sources of errors.
dependencies (they are tricky in MPS)
my jar
wrong cached files or so
Executing "run" causes the following error:
error: could not find or load main class MySolution.package.map_concept
Has some of you out there experience with this?
Tell me, if there are some extra information that would help.
It seems that you have added the jar file as a model to the language, which makes it invisible for the solution. Following the instructions at https://confluence.jetbrains.com/display/MPSD32/Getting+the+dependencies+right#Gettingthedependenciesright-AddingexternalJavaclassesandjarstoaprojectruntimesolutions and creating a separate library solution worked for me.
To me this looks like a problem of the generator. Have you fully rebuilt the project - right-click on the "project" node in the structure tree?
Is the root mapping template correct? If you can share your project, I can have a look.
A small tip that could have saved me some time and might also solve this problem for someone else, even if you followed the instructions in other answers.
When prompted to add your libraries to modules after including the libraries on Java tab, dismiss the window if you already included them in the first place on the Common tab. Otherwise they are listed once despite having been added twice, leading to a compilation failure.

The contents of jar file not found using jar design element of Designer 9

I dropped in an external jar file using the new jar design element of Notes 9.
I tried referencing it from a managed bean, and was able to compile. In runtime, I get a NoClassDefFoundError when I try to use the methods in the jar.
I have refreshed, cleaned, and rebuilded. Version 9 server and designer.
I remember in the past with 8.5.3 there was lots of issues getting the build path correct, but I thought that the new jar design element was supposed to take care of the issues. Most of the research I have found is from the days of 8.5.3 and earlier.
Any advice would be appreciated. (I am purposely not tagging java on this question since I think only XPagers would understand what to advise here)
2 steps to fix a potential issue:
Remove the database from designer. Delete the workspace project (only the project not the entire workspace!)
Add the database back. Check in the Java build path (right click in the navigator view on the database) that the Jar directory is included
Sometimes step 2 alone does the job, so start with that first.
As I remember early R9 versions have had issues with Java/JAR design elements. Put your JARs into WEB-INF folder (Project Browser view), that is my preferred way to use them.
Are JAR files in WebContent/WEB-INF/lib available to Java design elements in Domino Designer?
The solution that Stephan posted worked for my first attempt yesterday, so I am leaving it as the accepted answer. Today, I had to change the package name and the issue cropped up again.
This time nothing that Stephan or Frantisek suggested work to fix the NoClassDefFoundError exception. After trying everything, I came across this blog post. (A big thanks to Panu Haaramo who posted it in the comments in the answer of the SO that Frantisek's links to)
http://lotusandjava.blogspot.fi/2012/10/xpage-javalangnoclassdeffounderror.html
Renaming the jar caused the runtime engine to find the class file properly. Try this as well, as the solutions above to fix this problem. It is certainly an easy fix.

I want to use The GATE Predicate-Argument EXtractor Component (PAX)

I want to use The GATE Predicate-Argument EXtractor Component (PAX), but I can't figure out how to load the plugin on GATE developer (ver. 7)
Please help me.
How do I load it?
The MultiPaX plugin is a bit of a complex beast. You need to download the package from the homepage, unpack it (use something like 7-zip if you're on Windows) and then build it using Ant, which you will need to install separately - GATE used to bundle a copy of Ant but that is no longer the case since version 7. Once you have the plugin compiled and packaged you should be able to load it through the plugin manager the same as any other plugin.
However, to get anything useful out of the PR you need to build quite a complex pipeline including at least one of SUPPLE, MiniPar or the Stanford Parser PR. Getting these to work is itself a non-trivial task...
The predicate argument extractor is not developed by the core GATE team, so specific questions are probably better posted in the semanticsoftware.info forum (linked from the bottom of http://www.semanticsoftware.info/pax) rather than the usual GATE user list.

Resources