How is the java project separation?

Asked

Viewed 939 times

4

Well, I come from . net and there we have projects that we can divide them into class library and web project

I have my design just for my models Another only utils project and my web only project

In Java how is this separation made? I tried looking for some opensource java web project to see what the project structure looks like

Can someone explain me and if possible tell me a medium/large opensource project in java web (regardless of the framework)

  • what are models and utils? I don’t know anything about c#

  • MVC - M (Models) business classes, utils is only classes for assistance, security, generate xml or something you need, rs

  • Tip: You can use MAVEN. Your project structure can be used in N Ides. It serves for Desktop and Web Project, very practical and simple to use.

2 answers

4


One thing is the division into projects made by Ides like Eclipse and Netbeans and another thing is the division of Java into libraries.

A Java program dynamically loads classes and resources that are available on classpath, which can be defined as a parameter and consists of a list of directories and Jar files. Jar is basically a zip with classes compiled inside. So, basically you can plug any dependency by placing classes or jars in some directory included in classpath.

As for the organization for development, in general you can create projects of various types in Ides: libraries and programs desktop (jar), web (War), Enterprise with EJB (Ear). To define which projects depend on which, each IDE has its mechanisms, but note that this is only a logical configuration for the compilation, because as already described above, in practice, all classes see all.


Updating

As mentioned in the comments, there are tools build like Maven that allows you to configure the different projects, their dependencies, the artifacts generated, in short, the entire generation cycle.

It is a more generic and agnostic way of organizing projects. I strongly recommend it because it also facilitates integration into Continuous Integration tools, static code analysis, code generators, etc.

Yet this is not something intrinsic to Java, but a logical organization of projects.

  • 2

    Or you can "ignore" the organization of the IDE, which can be something specific to each of them and use the Maven .

  • @Ricardogiaviti Thanks for the tip, I had been wondering about this, but I had to go to a meeting and ended up publishing the answer without talking about Maven. But it’s really important to comment, so I updated the answer.

2

Browser other questions tagged

You are not signed in. Login or sign up in order to post.