Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6762

Multimodule project with .mvn/settings.xml not working properly

    XMLWordPrintableJSON

Details

    Description

      I have a project with the following setup:

       

      - MyProject
        |- .mvn
        |  |- maven.config
        |  |- settings.xml
        |- MyModule1
        |  |- pom.xml
        |- MyModule2
        |  |- pom.xml
        |- pom.xml

       

      The .mvn/maven.config file contains the following:

      ..
      --settings .mvn/settings.xml

      With this setup, I cannot build the modules separately because it cannot find the .mvn/settings.xml file in the MyModule1 directory.

       

      I looked into the code and saw that in the mvn script, the .mvn folder is searched for in the parent folders. If it is found, that folder is marked as the 'maven.multiModuleProjectDirectory'.

       

      However, as soon as the configuration is loaded, this multiModuleProjectDirectory is not used anymore for the interpretation of the --settings property, therefor maven tries to find the .mvn/settings.xml file inside the MyModule1 folder where it is not found.

      This results in an Exception and termination of Maven.

       

      I thought of a couple of ways this could be solved:

      • Allow for a variable substitution to work in the maven.config file and thus reference something like:
      ..
      --settings ${baseDir}/.mvn/settings.xml
      • When the maven.multiModuleProjectDirectory is configured and the --settings flag is a relative directory, than use the maven.multiModuleProjectDirectory as the root to obtain the settings.xml file.

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mminke Morten Minke
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m