Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-4113

Maven2 Project: the -s option is not interpreted during the execution of the build

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • maven-plugin
    • None
    • Platform: All, OS: All

      In our environment, we have few dedicated maven configuration files, one
      settings.xml per environement. These files are neither located in the
      %MAVEN_HOME%\conf nor in the %USERPROFILE%\.m2

      While configuring projects in Hudson, I have noticed the following problem: for
      "Maven 2 project" configuration, while specifying an alternate settings.xml
      path, (using -s option), the build is in failure. The -s option is not
      interpreted by the build.

      If I use the same command with a "free style" project configuration, the build
      is successful. The behavior is equivalent to the maven command line behavior.

      Is this behavior for "Maven 2 project" already known to the Hudson community? Is
      there

      • any planned fix or
      • a workaround different from using the freestyle configuration

      Regards,

      jean-michel legrand

          [JENKINS-4113] Maven2 Project: the -s option is not interpreted during the execution of the build

          jmlegrand added a comment -

          Created an attachment (id=805)
          Build error

          jmlegrand added a comment - Created an attachment (id=805) Build error

          Andrew Bayer added a comment -

          I can't see any reason why Hudson would have problems with the -s option - it'd
          just get passed straight to the Maven execution. Can you try running this job
          without the -s option to see if you get the same error? Do you have the "use
          private repository" advanced option selected? What version of Hudson are you using?

          Andrew Bayer added a comment - I can't see any reason why Hudson would have problems with the -s option - it'd just get passed straight to the Maven execution. Can you try running this job without the -s option to see if you get the same error? Do you have the "use private repository" advanced option selected? What version of Hudson are you using?

          jmlegrand added a comment -

          As said previously, the problem is seen for Maven 2 Project configuration (and
          NOT for Free Style Project configuration).

          If I run the job without the -S option, I get the same build failure as there is
          no settings.xml defined in my %MAVEN_HOME%\conf. This is in this case a correct
          behavior.

          The only way I found to make it work is:
          1- To copy the dedicated settings.xml (ie settings_developpement.xml) to
          %MAVEN_HOME%\conf and,
          2- To rename it settings.xml. This is not really acceptable as we manipulate
          multiple settings.xml files.

          I don't have the "use private repository" advanced option selected as I don't a
          dedicated local repository per project

          Regards,

          jml

          BTW, I am running:

          • hudson V1.314
          • maven 2.0.9

          jmlegrand added a comment - As said previously, the problem is seen for Maven 2 Project configuration (and NOT for Free Style Project configuration). If I run the job without the -S option, I get the same build failure as there is no settings.xml defined in my %MAVEN_HOME%\conf. This is in this case a correct behavior. The only way I found to make it work is: 1- To copy the dedicated settings.xml (ie settings_developpement.xml) to %MAVEN_HOME%\conf and, 2- To rename it settings.xml. This is not really acceptable as we manipulate multiple settings.xml files. I don't have the "use private repository" advanced option selected as I don't a dedicated local repository per project Regards, jml BTW, I am running: hudson V1.314 maven 2.0.9

          Andrew Bayer added a comment -

          Ok - just wanted to be sure I understood the whole scenario. Let me see what I
          can dig up.

          Andrew Bayer added a comment - Ok - just wanted to be sure I understood the whole scenario. Let me see what I can dig up.

          Andrew Bayer added a comment -

          Ah - found the cause, though not yet a fix. The problem here is not that the -s
          option isn't getting passed to Maven - if it ever got that far, it'd be passed
          just fine. The problem is that the POM parsing doesn't know anything about the
          -s option, and so isn't finding the artifact in question, since it's not in the
          default repository.

          I think the only way to fix this would be to add an option for specifying the
          settings file on a per-project basis, separate from the goals list, but I'm not
          sure if this might be adding too much complexity. Let me think about it.

          Andrew Bayer added a comment - Ah - found the cause, though not yet a fix. The problem here is not that the -s option isn't getting passed to Maven - if it ever got that far, it'd be passed just fine. The problem is that the POM parsing doesn't know anything about the -s option, and so isn't finding the artifact in question, since it's not in the default repository. I think the only way to fix this would be to add an option for specifying the settings file on a per-project basis, separate from the goals list, but I'm not sure if this might be adding too much complexity. Let me think about it.

          jmlegrand added a comment -

          How come the "-s option" isn't getting passed to Maven? This is a standard maven
          option. This option is passed to the Free Style configuration as well.

          We could indeed specifying the settings file on a per-project basis. At the same
          time, this settings project should be dynamically pick up at runtime by
          environement which add complexity (developpement_settings.xml in one case,
          integration_settings.xml in another case, ...)

          Anyway, thanks for your support. Waiting for your feedback.

          Regards,

          jean-michel

          jmlegrand added a comment - How come the "-s option" isn't getting passed to Maven? This is a standard maven option. This option is passed to the Free Style configuration as well. We could indeed specifying the settings file on a per-project basis. At the same time, this settings project should be dynamically pick up at runtime by environement which add complexity (developpement_settings.xml in one case, integration_settings.xml in another case, ...) Anyway, thanks for your support. Waiting for your feedback. Regards, jean-michel

          Andrew Bayer added a comment -

          It is getting passed to the actual Maven execution - it's just not getting
          picked up by the embedded Maven instance which is used solely for POM parsing.

          Andrew Bayer added a comment - It is getting passed to the actual Maven execution - it's just not getting picked up by the embedded Maven instance which is used solely for POM parsing.

          Andrew Bayer added a comment -

          Duplicate.

              • This issue has been marked as a duplicate of 2575 ***

          Andrew Bayer added a comment - Duplicate. This issue has been marked as a duplicate of 2575 ***

          jmlegrand added a comment -

          Thanks a lot for the patch.

          Do you know in which version it will get integrated?

          Regards,

          Jean-Michel

          jmlegrand added a comment - Thanks a lot for the patch. Do you know in which version it will get integrated? Regards, Jean-Michel

          Andrew Bayer added a comment -

          Should hopefully be in 1.319, next week's release.

          Andrew Bayer added a comment - Should hopefully be in 1.319, next week's release.

            abayer Andrew Bayer
            jmlegrand jmlegrand
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: