Coder Social home page Coder Social logo

Comments (12)

khalilou88 avatar khalilou88 commented on July 29, 2024

@shanon84
mavenRootDirectory option should fix all this issues (or at least most of them). The idea is to create all maven projects in a sub folder (with config files) and you isolate maven root project from NX root project.

I don't think is a good idea to mange projects as apps and libs as in your test repo. I believe it's more interesting to manage projects by technologies for better caching and performance. Inside mavenRootDirectory you can have two folders apps and libs if you want.

from jnxplus.

khalilou88 avatar khalilou88 commented on July 29, 2024

I forget to mention that adding maven root project to the graph is important to make the build target works. Check this old issue for more information #20

from jnxplus.

shanon84 avatar shanon84 commented on July 29, 2024

Hey, I had a deeper look into it.
mavenRootDirectory is a nice way to prevent the frontend access rules problem. But you still need another pom.xml in root folder to automatically let the IDE detect the repository as a maven project. This one needs to still be a multi module one targeting the newly added root pom in the subfolder by referencing it as a module. (and that was my point: aggregator pom not in project referencing all the projects for the IDE, but noone use it inside the projects)
In regards of the important of the root pom built: Well, you only need this one, if you use the aggregator pom as parent in your projects. If not, you do not need to build it. I had initial problems with the root pom, because I wanted to use a different target for FE and BE. So the root pom was not installed initially :D
Another big concern with the aggregator pom + root project:
If you add a new project to your 100 maven project repository, it results in a full build/test, because your root pom changes. Even if that does not impact anything (if you dont use root pom as parent in projects).

About caching and performance problems cause of mixing the technoligies:
How does this happen? What is the (root) problem here? It would be nice to know (I would prefer layering by logic/service (FE+BE as a unit) and not technoligy based)

from jnxplus.

khalilou88 avatar khalilou88 commented on July 29, 2024

@shanon84 did you try to add this pom.xml to .nxignore file https://nx.dev/reference/nxignore?

from jnxplus.

khalilou88 avatar khalilou88 commented on July 29, 2024

The problem of the aggregator pom with many modules is a common problem in Nx: here is a example with a typescript project https://x.com/AlexOkrushko/status/1659930346169806849

from jnxplus.

khalilou88 avatar khalilou88 commented on July 29, 2024

In nx-maven we have 3 types of links between projects:

  • Parent Project links
  • Aggregator Project links
  • Dependency links

We can add an option to remove Aggregator Project links: skipAggregatorProjectGraphLinking by default will be false.

To make nx-maven works in this case, we need to build Aggregator Projects first, then other projects.

from jnxplus.

shanon84 avatar shanon84 commented on July 29, 2024

Hey,
about the caching example:
Well, one of the reasons I would like to get rid of a required aggregtor pom project ^^ without this, you dont run into huge builtload. If you do not use the aggregator pom as parent pom in any submodule, you dont need the aggregator pom at all (only as an IDE helper to automatically import the maven projects correctly).
About the option:
Well, as I tryed to explain: if you do not use your aggregator pom as a parent in a module project, you do not need to build/install the aggregator pom at all. Out of the view of the module project, there is no aggregator. This way we have only use of NX projects and dont mix it with the conzept of maven aggregator. Only while creating the dependency graph the aggregator is used to find all projects, but later it is not present at all.
Mh, in my case/idea this solution should work. But to have a broader solution: Maybe dont add a maven project as a nx project if no project.json is in the same folder? This way you can mix the usage of aggregator. The ones only for IDE helping purpose without a project representation (no project.json). And the ones you want to have with a project.json present (for, I dont know? :D )
Or are there reasons to not have a project.json, but expecting to have a project present?

from jnxplus.

khalilou88 avatar khalilou88 commented on July 29, 2024

I already thought about making project.json mandatory, but with nx project crystal, it's better to keep the file optional.

from jnxplus.

khalilou88 avatar khalilou88 commented on July 29, 2024

@jbadeau what do you think about skipAggregatorProjectGraphLinking option? is useful for you?

from jnxplus.

jbadeau avatar jbadeau commented on July 29, 2024

I think it would be useful although im not sure it will fully work. can try.

from jnxplus.

khalilou88 avatar khalilou88 commented on July 29, 2024

@shanon84 @jbadeau
Please try the version 1.7.0-0.

from jnxplus.

shanon84 avatar shanon84 commented on July 29, 2024

@khalilou88
Yes, it works like planned.
Still would like the other option too to not create a project if a project.json is not present ^^
Because with skipAggregatorProjectGraphLinking active you have completely useless aggregator projects left. Could skip them to not build them/not see them in nx graph. Also not messing up root folder (if not moving the maven project path)

something like:
const projectJsonPath = path.join(projectAbsolutePath, 'project.json'); if (!onlyCreateProjectWithProjectJsonPresent || fs.existsSync(projectJsonPath)) { projects.push({ .....

Tested it out in my test monorepo and it worked like expected.

from jnxplus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.