Comments (12)
@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.
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.
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.
@shanon84 did you try to add this pom.xml
to .nxignore
file https://nx.dev/reference/nxignore?
from jnxplus.
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.
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.
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.
I already thought about making project.json
mandatory, but with nx project crystal, it's better to keep the file optional.
from jnxplus.
@jbadeau what do you think about skipAggregatorProjectGraphLinking
option? is useful for you?
from jnxplus.
I think it would be useful although im not sure it will fully work. can try.
from jnxplus.
@shanon84 @jbadeau
Please try the version 1.7.0-0.
from jnxplus.
@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)
- {options.outputDirLocalRepo} not working if moved to nx.json HOT 6
- NX remove does not remove Gradle module from settings.gradle.kts HOT 1
- [nx-maven] Hyphen '-' is not removed in @SpringBootApplication(scanBasePackages = "com.acme.sda-example") HOT 1
- THANK YOU
- How to use ktlint for nx-maven and nx-gradle? HOT 6
- nx show projects hangs with @jnxplus/nx-maven:0.24.3 and nx:17.0.2 HOT 17
- Version 1.0.0 with Nx 19 HOT 2
- Project crystal HOT 6
- Logs not visible when running the application HOT 4
- Gradle :projectDependencyTask fails if NX Daemon is not running HOT 3
- {options.outputDirLocalRepo} not caching HOT 11
- Export nx-maven run-task executor HOT 2
- nx-maven:run-task skipProject option HOT 8
- Project not marked as affected if dependency upgraded HOT 5
- Performance and mvnd HOT 7
- 1.2.0 and 1.3.0+ problems HOT 4
- jnxplus and nx remote caches HOT 3
- Exclude src/test from build
- consider profile dependencies in maven graph HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jnxplus.