How to build Liferay 7 WSRP module? - gradle

I am trying to build Liferay 7 wsrp module from Liferay GitHub repository.
I couldn't build entire Liferay source, is it possible to build this wsrp module only ?
If anybody has a jar file working on Liferay 7 CE ga2 or ga3, please share.

Important Edit:
You don't actually need to rely on the Liferay Portal jars for most modules. The reason this one failed as it did was that simply running gradlew deploy in modules/apps/wsrp will automatically include all subprojects, which includes wsrp-test. The "-test" modules rely on the com.liferay.portal.test-integration artifact.
However, if you add the option -Dbuild.profile=portal to your command, the Gradle wrapper liferay-portal will only include modules that contain the .lfrbuild-portal marker file, which all of the wsrp modules have except for wsrp-test.
Original Post:
Liferay has a Maven repository that hosts their public artifacts.
Their portal artifacts can be found here: https://repository.liferay.com/nexus/content/groups/public/com/liferay/portal/
However, if you're building a module from the source in their Git repo, the latest release/snapshot on the Maven repo might be out of date. Snapshots are updated fairly frequently, but this is still a possibility. The safest thing to do is to just compile the portal from source.

Related

Deployed Maven Attached Artifacts on Github Remain Inaccessible

I have a maven module which is configured with a feature packaging (an Apache Karaf feature). This project has no primary artifact to deploy but an attached feature.xml file. When I try to deploy the project to Github package the upload seems to work:
Uploaded to github: https://maven.pkg.github.com/cdelg-ct/repo/com/mycompany/app/my-mod/1.0-SNAPSHOT/my-mod-1.0-20200701.090836-1-features.xml
But then, the above file does not show up in the Github Packages UI and other projects cannot depend on it (Could not find artifact). Note the pom is well deployed as the other sibling jar modules.
Did anyone manage to get classifier to work with Github Maven Packages?
You are using a SNAPSHOT version.
By default, SNAPSHOT versions are not fetched.
Quick way to check it, try a release version.
If it works, you have to configure your maven settings to allow spapshots versions.

After making a Gradle groovy jar library how to make it re-usable for multiple local projects?

Here I read about how to make a Groovy library .jar ... i.e. pretty much the same as making a Groovy (standalone) project. But I'm not clear what you do then with the resultant .jar...
Say I have two Eclipse "proper"/"standalone" projects (I'm using Groovy for everything) and I want them to share a third Gradle library project of mine as a dependency, which is merely a library of classes... how are my standalone projects expected to find the latest .jar version of the library which they're both using...?
My expectation would be that somehow these versions of the library .jar would have to under GRADLE_USER_HOME (i.e. same location as all other dependency .jars).
Then I would assume that in the build.gradle of both standalone projects you'd have a line like
compile 'mylibrary:mylibrarymodule:3.+'
... of course the first part of these compile directives normally involves a "domain name in reverse" ... and this is normally used by a repository like Maven. How does it work with something which doesn't need to be published?
NB at the time of writing I don't have a Maven account as such and have no idea whether "publication" for re-use of a local common library project like this is essential or not.
Naturally, when I distribute versions of my standalone projects they will need to be packaged up with the library .jar in question.
A link to a how-to for a case like this would be more than welcome: I haven't found it under gradle.org.
If you are developing by yourself, you can use maven-publish plugin to publish your artifacts to local maven repository(you don't have to install maven for this) and on your dependent project you can simply say use mavenLocal repository for dependencies.
If you are on a company, I suggest installing a repository manager and deploy your artifacts to this repository so others can use. You can use their respective plugins to deploy easily. (Gradle Artifactory Plugin, Gradle Nexus Plugin, these are just deployment plugins, you have to setup respository manager to. There are other repository management tools also.) Doing the above process from CI server is the preferred way.
To use latest version of a dependency, you can use Gradle Versions Plugin. If the versioning happen often, using snapshot versions also a possibility.

What is the recommended usage pattern for karaf-maven-plugin?

I have a bunch of java classes and a bundle activator class that I need to deploy to karaf.
I see that the karat-maven-plugin has kar packaging and karaf-assembly.
Also it generates features.xml
I can generate features.xml directly and it generates lines with wrap: for some of my dependent non-osgi jars.
But when I run karat-assembly, I run into the issue of the assembly goal not realizing that these jars are not osgi and end up with errors.
What it the recommended way to get a custom karaf with my application installed ?
Does the karat-assembly packaging need to have a features.xml generated and provided beforehand ? Or is it supposed to do the feature set generation by itself ? If it is the latter, then how do I get around the problem of the karat-assembly not recognizing non-osgi jars ?
I have spent a LOT of time with google and am stumped.
This is my procedure for creating a custom karaf distribution. It may not be "best practice" but it works for me. Maybe you can customize for your needs.
After developing my Camel routes and testing I generate my feature file based on a feature template found in /src/main/feature/feature.xml. The karaf-maven-plugin will generate the feature will in the feature folder inside /target.
I do a clean deploy to our maven artifactory.
I have a custom Karaf project do a clean install on that project. The project has dependencies to the initial project and I add all the features as boot level feature.
Once build I unzip the distribution and run the Karaf app. If everything looks ok its ready to be shipped.

IntelliJ No files were downloaded for xyz

I've created a new project in IntelliJ.
When I go in to:
Project Structure -> Libraries -> Add -> From Maven -> 'com.atlassian.seraph:atlassian-seraph:3.0.3'
I get the error message 'No files were downloaded for com.atlassian.seraph:atlassian-seraph:3.0.3'
Backstory:
I'm using IntelliJ to write a custom SSO authenticator for JIRA. This is not a JIRA plugin, it's just a class that a custom JSP will use.
I intend to produce a JAR and put it in WEB-INF/lib.
I'm not sure what I've missed here. This is my first exposure to maven and I've googled this extensively.
If you did not change the default remote repository of your maven, it should be this . It seems that the artifact (com.atlassian.seraph:atlassian-seraph:3.0.3), you are looking for, is not in the default remote repository. There are two solutions for your case,
1.Add a new remote repository, which has this artifact, to your project.
2.Find the jar file somewhere on internet, add it to your project as an external jar file. Here is a great tutorial about this.
I've changed from idea 14 to idea 15, and downloading maven jar feature started to work)
My Maven setup in ide aimed to external v3.2.1, but may be it would work even with bundled one.

How to enable inside glassfish access to maven repository?

I have a following problem. We have a central maven repository hosted on our company server. Our team is working on a project. Everyone here uses that repository to get the required artifacts. If something is missing at the moment and is required for the task that the developer is currently dealing with, he installs this artifact manually to the central repository, so that his commits don't break the automated builds.
Now, each developer also has Glassfish v2 installed on his machine. That is for testing and debugging purposes. Before committing the changes, developer makes the .ear for the project with Maven help. However, after the developer deploys the ear to it's local glassfish, frequent errors arise, because the set of glassfish libraries may not contain all the latest dependencies of the central company repository.
Right now in case of the error the developer simply reads the log and looks what exactly is missing. After that he manually copies the required jar inside his local $GLASSFISH_HOME$/lib dir. But that seems a little bit frustrating. How can this be done automatically?
Right now we are trying to implement the following solution. The developer has to synchronize his local maven repository gathering all the artifacts from the central one that are required by the project. This local repository has to be placed on the java classpath, so that glassfish would also see it. Is that a correct approach? Maybe there is a way to install directly all the required artifacts from the central repository inside $GLASSFISH_HOME$/dir and this can be done automatically during deploy?
About having to install dependencies. If the developers need to install dependencies missing from public maven repositories, take into account that usually maven proxies have the ability to cache public repos. For instance, archiva has a proxying cache. If the dependencies are your own project deliverables you should consider releasing and deploying with maven to your company repo.
About latest versions. You need to specify maven what version of dependencies should use. I would prefer editing my poms manually, anyway there's a variety of ways to achieve that.
The libraries should be part of the project, I think. If not standard libraries of glassfish, they should be included, for instance, in your war file as part of your project. If not standard but not part of your project (not the regular approach) consider managing this glassfish as a project on its own (own git/svn repo, own pom, own versions, own everything).
Good luck.

Resources