Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mavenRootDirectories Or maven multi root projects workspace #557

Open
jbadeau opened this issue Oct 24, 2023 · 6 comments
Open

mavenRootDirectories Or maven multi root projects workspace #557

jbadeau opened this issue Oct 24, 2023 · 6 comments

Comments

@jbadeau
Copy link

jbadeau commented Oct 24, 2023

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
Copy link
Owner

khalilou88 commented Oct 24, 2023

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

  • Try nx-maven and nx gradle in the same workspace
  • Try the same architecture you want but without mavenRootDirectories, for that we can use the directory option from create app, lib and parent-project generators. Also parentProject and aggregatorProject options will be useful here.
    We can, for example, make app1 root project with java 17, app2 with java 21...

I will keep the issue open for more ideas

@khalilou88
Copy link
Owner

khalilou88 commented Feb 9, 2024

@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:

  • A maven root project is a pom project without aggregator project.
  • Every project should have a property that we will be filled dynamically mavenRootDirectory. So when we call nx targetName on that project, we will know where to execute the command.

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

@khalilou88
Copy link
Owner

khalilou88 commented Feb 9, 2024

  • We will have two types of workspaces : unique root project with . as projectRoot and multi root projects.
  • local Repo should be set per workspace to use libs in all workspace.
  • NX_SKIP_MAVEN_WRAPPER should be set per workspace and per root project.

@khalilou88
Copy link
Owner

khalilou88 commented Feb 9, 2024

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
Copy link
Owner

khalilou88 commented Feb 9, 2024

Second step is to adapt init generator for two situation:

  • unique root project.
  • multi root projects.

@khalilou88
Copy link
Owner

khalilou88 commented Feb 9, 2024

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

@khalilou88 khalilou88 changed the title mavenRootDirectories mavenRootDirectories Or maven multi root projects workspace Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants