khalilou88 / jnxplus

Nx plugins that adds Java/Kotlin monorepo support to Nx workspace using Gradle and Maven
MIT License
63 stars 15 forks source link

mavenRootDirectories Or maven multi root projects workspace #557

Open jbadeau opened 11 months ago

jbadeau commented 11 months ago

Very cool that you are using the new plugin options. Things are working nicely! I do have a suggestion for an improvment.

Could we change this:

{
"plugins": [
    {
      "plugin": "@jnxplus/nx-maven",
      "options": {
        "mavenRootDirectory": "ignite/root"
      }
    }
  ]
}

To the following:

{
"plugins": [
    {
      "plugin": "@jnxplus/nx-maven",
      "options": {
        "mavenRootDirectories": ["app1", "app2"]
      }
    }
  ]
}

I have seen that many monorepos seperate by apps or domain so a single maven root is problematic. Could the options be changed like this?

khalilou88 commented 11 months ago

Hi @jbadeau I don't think the plugin is better for that architecture because it will be too sequential. try first folder then second. The graph also will do the same and try to connect projects from different root folders (a lot of change to do).

I feel what you want is what nx-spring-boot provide : more freedom to build the projects as you want and the graph is done with other manner.

But i see good ideas in your demand

I will keep the issue open for more ideas

khalilou88 commented 7 months ago

@jbadeau instead of changing option mavenRootDirectory to mavenRootDirectories, the solution should be to remove mavenRootDirectory option.

When collecting xml files, this will help to construct the graph:

At the moment, i don't know if nx allow extending project data?

khalilou88 commented 7 months ago
khalilou88 commented 7 months ago

First step to implements this feature is to remove mavenRootDirectory option and refactor the graph algorithm. And parentProject and aggregatorProject options will not accept empty string anymore except if dir option is provided.

khalilou88 commented 7 months ago

Second step is to adapt init generator for two situation:

khalilou88 commented 7 months ago

Add a new generator rootProject this will throw an exception if the workspace is unique root project. Or adapt parentProject generator for this new usecase