Please explain what is this project is about (Multi Module Java Project)?

I have no idea what's going on here with the ejb, cor, web and stuff and the purpose of this project.
70 Replies
JavaBot
JavaBot10mo ago
This post has been reserved for your question.
Hey @Rag...JN 🌌 🦡 👽 💰! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st10mo ago
ok so you have multiple modules You can imagine each of these modules as its own Maven project But - When building the top module, it builds all of the modules - Modules can be dependencies of each other
Rag...JN 🌌 🦡 👽 💰 🐊
ok alright
dan1st
dan1st10mo ago
e.g. the web module uses the core module
Rag...JN 🌌 🦡 👽 💰 🐊
I want to run the app Is it same like running with adding a the server ?
dan1st
dan1st10mo ago
?
Rag...JN 🌌 🦡 👽 💰 🐊
like this
No description
Rag...JN 🌌 🦡 👽 💰 🐊
it has 4 artifacts
No description
dan1st
dan1st10mo ago
you probably need one of the web ones actually I think you need one of the ear ones
Rag...JN 🌌 🦡 👽 💰 🐊
ok let me try no it can't only the war alright I managed to run it I needed to use GlassFish instead of Payara @dan1st | Daniel forgive me for the ping But what subject is this, so I can learn about it
dan1st
dan1st10mo ago
Jakarta EE deployments essentially WAR and EAR are special JAR files that can be deployed to Jakarta EE servers
Rag...JN 🌌 🦡 👽 💰 🐊
How about these annotations and stuff
dan1st
dan1st10mo ago
WAR = web application archive EAR = enterprise application archive (I think) which annotations specifically?
Rag...JN 🌌 🦡 👽 💰 🐊
The stateless in package jakarta.ejb
dan1st
dan1st10mo ago
Stateless (Jakarta EE Platform API)
declaration: package: jakarta.ejb, annotation type: Stateless
Rag...JN 🌌 🦡 👽 💰 🐊
I have no clear idea where to start still. So I will try with Jakarta EE deployments ?
dan1st
dan1st10mo ago
I mean, I guess you generally want to get an idea about Jakarta EE I think information on stateless itself can be found in the spec here: https://jakarta.ee/specifications/enterprise-beans/4.0/jakarta-enterprise-beans-spec-core-4.0#stateless-session-beans
Rag...JN 🌌 🦡 👽 💰 🐊
alright sir
JavaBot
JavaBot10mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Rag...JN 🌌 🦡 👽 💰 🐊
why this can't be in just the main project's src or just inside the web project packages? you create a package called core for interfaces and ejb for interface implementation and use them inside the controllers
dan1st
dan1st10mo ago
could be maintainability it's easier to maintain multiple smaller modules than one big module in many cases
Rag...JN 🌌 🦡 👽 💰 🐊
alright alright that make sense
dan1st
dan1st10mo ago
or you could have a client and a server and they share some code so you create 3 modules - one for the common code, one for the server and one for the client - then the client doesn't contain the server code and vice-versa or you could have different teams working on different modules
Rag...JN 🌌 🦡 👽 💰 🐊
Inside the web moduel's pom.xml
No description
Rag...JN 🌌 🦡 👽 💰 🐊
So this plugin does this
The WAR Plugin is responsible for collecting all artifact dependencies, classes and resources of the web application and packaging them into a web application archive.
So only what's inside the web module gets packaged?
dan1st
dan1st10mo ago
the war plugin essentially creates the WAR file
Rag...JN 🌌 🦡 👽 💰 🐊
but here the core module also used as a dependency it will be packaged as well?
dan1st
dan1st10mo ago
and for that, it uses the dependencies of the same module and the code in that module ofc
Rag...JN 🌌 🦡 👽 💰 🐊
So what if I used the web module as a dependency inside the core module as well? will there be an exception occur
dan1st
dan1st10mo ago
then you have circular dependencies so yes because web requires core which requires web
Rag...JN 🌌 🦡 👽 💰 🐊
core ----pom.xml ================= dependency -> has web module web ---pom.xml ================ dependency -> has core module alright ok got it
dan1st
dan1st10mo ago
However, it might be possible as a test dependency but I didn't test that (pun intended)
Rag...JN 🌌 🦡 👽 💰 🐊
what is this section (the right bar) I only declared one plugin but the bar has multiple plugins?
No description
Rag...JN 🌌 🦡 👽 💰 🐊
the core plugins
dan1st
dan1st10mo ago
These are plugins Maven adds by default
dan1st
dan1st10mo ago
For example the compiler plugin compiles your application Also you have a <parent> element, right?
dan1st
dan1st10mo ago
almost all configuration from the <parent> is copied to the child and there's kinda a default parent which isn't really shown and you can also add stuff to the POM via profiles
Rag...JN 🌌 🦡 👽 💰 🐊
oh shit I removed the maven-war-plugin and now the war core plugin is gone So the remaining are the default core plugins
dan1st
dan1st10mo ago
You can execute the command mvn help:effective-pom and it should show you the POM after these things have been applied Do you have a <packaging> tag?
dan1st
dan1st10mo ago
ok I thought that should add the maven-war-plugin by default but maybe it's just IntelliJ not showing it
Rag...JN 🌌 🦡 👽 💰 🐊
no no I added it default (followed the sample project)
dan1st
dan1st10mo ago
I meant that Maven should implicitely add it if you don't
Rag...JN 🌌 🦡 👽 💰 🐊
alright module ejb's pom.xml
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jiat</groupId>
<artifactId>webmulti</artifactId>
<version>1.0</version>
</parent>

<artifactId>ejb</artifactId>
<packaging>ejb</packaging>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.ejb</groupId>
<artifactId>jakarta.ejb-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jiat</groupId>
<artifactId>core</artifactId>
<version>1.1</version>
<type>jar</type>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>3.2.1</version>
</plugin>
</plugins>
</build>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jiat</groupId>
<artifactId>webmulti</artifactId>
<version>1.0</version>
</parent>

<artifactId>ejb</artifactId>
<packaging>ejb</packaging>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.ejb</groupId>
<artifactId>jakarta.ejb-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jiat</groupId>
<artifactId>core</artifactId>
<version>1.1</version>
<type>jar</type>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>3.2.1</version>
</plugin>
</plugins>
</build>
questions 1. why ejb uses web api 2. why core module is used as a jar type dependency 3. what's up with the ejb plugin
dan1st
dan1st10mo ago
why ejb uses web api
tbh I don't know - but I guess it's so that when you deploy the EAR, everything from the web package should be included as well
why core module is used as a jar type dependency
jar is the default - if you just want to use something as a library/used by other things OR if you want to execute it with java -jar, you'd normally use jar
what's up with the ejb plugin
I think that's responsible for the EAR file but I have never worked with EJB/EAR stuff
Rag...JN 🌌 🦡 👽 💰 🐊
hope me neither 😆
Rag...JN 🌌 🦡 👽 💰 🐊
probably this
No description
dan1st
dan1st10mo ago
and I think this creates an EAR file in the package phase
Rag...JN 🌌 🦡 👽 💰 🐊
I will first study about EJB and then EAR ^
dan1st
dan1st10mo ago
idk how helpful the spec is for that
Rag...JN 🌌 🦡 👽 💰 🐊
I will see i am going to eat now
dan1st
dan1st10mo ago
You might be more successful with tutorials or blog posts about it the spec is probably more useful for reference or if you want to implement a server
Rag...JN 🌌 🦡 👽 💰 🐊
What does it mean by local and remote It's something with RMI?
dan1st
dan1st10mo ago
where does it say that? local typically means on the same device and remote typically means on a different one
Rag...JN 🌌 🦡 👽 💰 🐊
Starting from line 8
dan1st
dan1st10mo ago
ah there I looked over that yeah local network access means things on the same computer (or maybe things in the same network) and remote means communicating with other servers or similar
Rag...JN 🌌 🦡 👽 💰 🐊
yah but why it matters when you run a server? oh wait no stupid question
dan1st
dan1st10mo ago
I mean, idk much about EJB As I said, maybe check introductory articles orr similar maybe there are some freely available books as well if you are into books
Rag...JN 🌌 🦡 👽 💰 🐊
ah ok btw any idea if I can do this tutorial in a plain ant project? https://www.javatpoint.com/RMI
www.javatpoint.com
Remote Method Invocation (RMI) - javatpoint
Remote Method Invocation (rmi) is an API that provides a mechanism to create distributed application in java.
Rag...JN 🌌 🦡 👽 💰 🐊
ok I downloaded the project
JavaBot
JavaBot10mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server