import a project on another project with gradle on eclipse - spring

I'm trying to use Gradle as Spring MVC project builder. I divide my project in two distinct ones, the first project will contain the Repository and service part, and the second one, the views and controllers (web part)
My problem is when I try to deploy my project, the server don't see the entities from the first project. It also doesn't deploy this first project.
I think it due to Gradle, but I don't know how to indicate to gradle to import the first project on the second one.

You have to create a multi project with the following hirarchy:
Root Project
settings.gradle
service
build.gradle
...
web
build.gradle
...
The settings.gradle has to include the following
include 'service'
include 'web'
Now the web project can use the service project with the following code in the build.gradle:
dependencies {
compile project(':service')
}

Related

Injection Dependy of a Multimodule Maven project in Maven

I have the following issue.
On one hand I have a multi module maven project, which I use maven install to write the .jar files in my local .m2 repository. This is working fine. Lets call it MultiA.
Now on the other hand, I have a spring boot project (lets call it SpringB) in which I bind the .jar files from my multi module maven project. This is working fine as well. When I execute my buisness logic from IntelliJ, I receive no issue, but when I build the project as a .jar, I receive an issue because the settings.properties file from MultiA are not found. I do not try to access settings.properties from SpringB, but I call a method from MultiA, which in return trys to access the settings properties.
I hope, this description helps and someone knows the answer to this problem.

Call a flow of one mule project in another mule project

I have a mule project-A where in I need to call a flow from another mule project-B. I have added <classifier>mule-plugin</classifier> in the project-B's pom. And I have added a dependency with project-B's group-Id, version, artifact-Id, classifier in project-A's pom and also created an "import" config in project-A with flow name of project-B which I want to use. Still I am unable to call the flow of project-B in project-A
If you are implementing this to just test in your local machine, then follow the below steps. You can also look at the concept of Mule Domain Project, which does resource sharing for those apps falling under the same domain ; enabling you to call other apps flow-refs, global configurations and more.
Note : All this below said has to be in Mule 4.
First, export your Project-B as a mule deployable jar.
Steps
Right click on Project-A and goto - > mule
Add a maven dependency.
Choose your Project-B.jar from your local repository and
add.
This will get your project imported as a maven dependency
in your pom.xml file.
Make sure your jar added under your project libraries of 'A' in
the package explorer.
Goto to the global elements of Project-A and select import
configurations.
Add the Import configuration to your elements and specify
your Project-B main XML file you want to use in Project-A.
Finally refresh/restart your main project and check if you can
reference the flows.
If you still can't get this work, try updating to the latest version of studio, like 4.3.1 which is a much stable version.
Detailed explanation is given here -> Mule Shared Projects
Update
You can also try doing the same in your cloudhub runtime. You don't need a Domain project concept to do this. Basically you kind of imported your Project-B into Project-A completely ; Altogether making it a one mashed up Mega project.

Gradle: Combine jars from sub-projects

I have a multi module gradle project. The project contains two subproject, i.e. a spring-boot application server and an npm front-end ui (which is just static javascript).
I can build both sub-projects. I can define:
implementation(project(':ui'))
in the dependencies section of the spring application and I get a running jar in the server projects build folder successfully serving the frontend.
However, I want to be able not to combine the two not within the server sub-project, but rather in the enclosing project.
I thought of something like:
build.gradle:
allprojects {
group = 'com.example.webapp'
version = '0.0.1-SNAPSHOT'
}
dependencies {
implementation(project(':server'))
implementation(project(':ui'))
}
settings.gradle:
rootProject.name = 'webapp'
include 'server', 'ui'
I think, I am completely wrong. Everything I find about gradle is either completely basic, or assumes way more than what I understood about it so far.
EDIT:
With my solution approach I am getting the following error:
A problem occurred evaluating root project 'webapp'.
Could not find method implementation() for arguments [project ':server'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
EDIT 2:
The basic idea is from https://ordina-jworks.github.io/architecture/2018/10/12/spring-boot-angular-gradle.html
The implementation not found is caused by the lack of plugins applied to your root project. The implementation configuration is created by the java plugins in Gradle.
What you are trying to achieve requires a good understanding of Gradle and all the magic provided by the Spring Boot plugin.
You are effectively trying to reproduce some of that integration in your root project, without the help of the plugins.
An approach that might be easier would be to migrate your application project to be the root project and then have the ui as a subproject.

Liferay7 service builder dependency

I have created a service builder project (Gradle type) in Liferay7 called register-user. There is another service builder project called register-organization. I have a situation where one of the service builders depends upon other. However, i am not able to figure out where to put the dependency of one into another. Is there is any way to do that?
With each servicebuilder project you create from the template, you get two projects, e.g. register-user-api and register-user-service. The -service project depends on the -api project and has the dependency noted in its build.gradle. Look it up and use exactly the same notation to make any other project depend on register-user-api.
The situation changes if both projects do not live in the same workspace: In that case you'll need your own repository (e.g. proxy for Maven Central) where you publish your own modules. Then you can just declare a standard dependency for your modules.

how to access some new java classes added to the existing jar from gwt project when we run with Maven

I am facing below issue when I am running maven for gwt project.
in my project we have "A" project created by using gwt frame work.
"B" project is a java project and we need to access B project classes in "A" project server side.so created a jar for B project and added in A project build path.
Now I need to add some new classes in B project and that new classes should access from "A" project client side.
We can able to add new classes in B project and after running maven for B-project, we are able to see new classes in B-project jar.
But when I run maven for Project A it shows an error like "did you forget to inherit a required module?".
Note: same test projects I have created and can able to access B-project new classes in A-project client side code. But when I am running with Maven it is unable inheriting these new classes.
Kindly advise me how to solve this issue.
Generally you need to compile your code into javascript in order to make it accessible from the client side (if we aren't considering requestfactory proxies, web services etc. here). If your code is located outside the GWT module it simply doesn't exist for client side. Practically this means that you need to extract the client side accessible classes from the B module and put it into A\shared folder for example. Also don't forget to place <source path="shared" /> into your A gwt.xml descriptor. The drawback of this refactoring of course is that you're allowed to use only "JRE emulated" classes in your shared code.
Another solution would be a creation of a gwt module inside your B project and inheriting it in A project.

Resources