• Icon: Task Task
    • Resolution: Fixed
    • Icon: Major Major
    • plugin-pom
    • None

      You should not need to ignore .flattened-pom.xml: it should live inside target.

          [JENKINS-51247] Move flattened POM into target directory

          Jesse Glick added a comment -

          What seems to be working so far in most cases: remove executions of the clean goal, and override

          <outputDirectory>${project.build.directory}</outputDirectory>
          <flattenedPomFilename>${project.artifactId}-${project.version}.pom</flattenedPomFilename>
          

          I noticed one behavioral change in findbugs-maven-plugin (relative paths in findbugs.excludeFilterFile are not resolved), but it is not clear what the correct behavior was there anyway; prepending ${project.basedir}/ fixes it.

          Now I am tracking down a problem in frontend-maven-plugin: node commands get run from target as the CWD. This code seems to be getting the wrong value—but only when the project version is not a snapshot. Of course I cannot reproduce a similar problem using a simple test mojo. This seems to have something to do with source:jar running a forked Maven execution, thus rerunning lots of mojos, in which the basedir is apparently wrong. The produce-incrementals profile runs this mojo, which is presumably the trigger.

          I notice that MavenProject.deepCopy is wrong (calls setFile and thus sets basedir of the clone to target). I am guessing that is the culprit behind both problems—they involve forked executions. (@Execute annotation)

          Summary: making this switch is not completely safe, but can be done.

          Jesse Glick added a comment - What seems to be working so far in most cases: remove executions of the clean goal, and override <outputDirectory> ${project.build.directory} </outputDirectory> <flattenedPomFilename> ${project.artifactId}-${project.version}.pom </flattenedPomFilename> I noticed one behavioral change in findbugs-maven-plugin (relative paths in findbugs.excludeFilterFile are not resolved), but it is not clear what the correct behavior was there anyway; prepending ${project.basedir}/ fixes it. Now I am tracking down a problem in frontend-maven-plugin : node commands get run from target as the CWD. This code seems to be getting the wrong value—but only when the project version is not a snapshot. Of course I cannot reproduce a similar problem using a simple test mojo. This seems to have something to do with source:jar running a forked Maven execution, thus rerunning lots of mojos, in which the basedir is apparently wrong. The produce-incrementals profile runs this mojo, which is presumably the trigger. I notice that MavenProject.deepCopy is wrong (calls setFile and thus sets basedir of the clone to target ). I am guessing that is the culprit behind both problems—they involve forked executions. ( @Execute annotation) Summary: making this switch is not completely safe, but can be done.

          Jesse Glick added a comment -

          I think I have it. Given this mojo

          @Mojo(name = "test", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
          public class TestMojo extends AbstractMojo {
              @Parameter(defaultValue = "${basedir}")
              private File workingDirectory;
              public void execute() throws MojoExecutionException {
                  getLog().info("running in " + workingDirectory);
              }
          }
          

          invoked as

          <plugin>
              <groupId>test</groupId>
              <artifactId>flatten-maven-plugin-53</artifactId>
              <version>1.0-SNAPSHOT</version>
              <executions>
                  <execution>
                      <id>test</id>
                      <goals>
                          <goal>test</goal>
                      </goals>
                  </execution>
              </executions>
          </plugin>
          

          If produce-incrementals is configure to use source:jar, it gets run twice, once with the basedir, once with target. Using source:jar-no-fork, it runs just once, with the correct basedir.

          Jesse Glick added a comment - I think I have it. Given this mojo @Mojo(name = "test" , defaultPhase = LifecyclePhase.GENERATE_SOURCES) public class TestMojo extends AbstractMojo { @Parameter(defaultValue = "${basedir}" ) private File workingDirectory; public void execute() throws MojoExecutionException { getLog().info( "running in " + workingDirectory); } } invoked as <plugin> <groupId> test </groupId> <artifactId> flatten-maven-plugin-53 </artifactId> <version> 1.0-SNAPSHOT </version> <executions> <execution> <id> test </id> <goals> <goal> test </goal> </goals> </execution> </executions> </plugin> If produce-incrementals is configure to use source:jar , it gets run twice, once with the basedir, once with target . Using source:jar-no-fork , it runs just once, with the correct basedir.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          http://jenkins-ci.org/commit/plugin-pom/e4689b8d5f6e76a755f09adbdb7b3fc8c301f8ea
          Log:
          JENKINS-51247 source:jar, not source:jar-no-fork

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml http://jenkins-ci.org/commit/plugin-pom/e4689b8d5f6e76a755f09adbdb7b3fc8c301f8ea Log: JENKINS-51247 source:jar, not source:jar-no-fork

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          http://jenkins-ci.org/commit/plugin-pom/753d0856d9fdef5aa526d8ed154aa242bd7a8144
          Log:
          Merge pull request #105 from jglick/flatten

          JENKINS-51247 Simplified usage of flatten-maven-plugin

          Compare: https://github.com/jenkinsci/plugin-pom/compare/f8a5e377fe2d...753d0856d9fd
          *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

          Functionality will be removed from GitHub.com on January 31st, 2019.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml http://jenkins-ci.org/commit/plugin-pom/753d0856d9fdef5aa526d8ed154aa242bd7a8144 Log: Merge pull request #105 from jglick/flatten JENKINS-51247 Simplified usage of flatten-maven-plugin Compare: https://github.com/jenkinsci/plugin-pom/compare/f8a5e377fe2d...753d0856d9fd * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          http://jenkins-ci.org/commit/pom/e940c43f7ddc29ae44503bb58a1d8df82ce8d2f2
          Log:
          JENKINS-51247 source:jar, not source:jar-no-fork

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml http://jenkins-ci.org/commit/pom/e940c43f7ddc29ae44503bb58a1d8df82ce8d2f2 Log: JENKINS-51247 source:jar, not source:jar-no-fork

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          http://jenkins-ci.org/commit/pom/3770b93a9478e56584a02a79dddd2f8929ccf44e
          Log:
          Merge pull request #24 from jglick/flatten

          JENKINS-51247 Simplified usage of flatten-maven-plugin

          Compare: https://github.com/jenkinsci/pom/compare/54d67630d3e7...3770b93a9478
          *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

          Functionality will be removed from GitHub.com on January 31st, 2019.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml http://jenkins-ci.org/commit/pom/3770b93a9478e56584a02a79dddd2f8929ccf44e Log: Merge pull request #24 from jglick/flatten JENKINS-51247 Simplified usage of flatten-maven-plugin Compare: https://github.com/jenkinsci/pom/compare/54d67630d3e7...3770b93a9478 * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          README.md
          http://jenkins-ci.org/commit/incrementals-tools/504d389e029ac16d4ffa0bf7c815dd91c274f583
          Log:
          Merge pull request #1 from jenkinsci/flatten

          JENKINS-51247 Amending instructions to reflect flatten-maven-plugin configuration change

          Compare: https://github.com/jenkinsci/incrementals-tools/compare/451599508e71...504d389e029a
          *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

          Functionality will be removed from GitHub.com on January 31st, 2019.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: README.md http://jenkins-ci.org/commit/incrementals-tools/504d389e029ac16d4ffa0bf7c815dd91c274f583 Log: Merge pull request #1 from jenkinsci/flatten JENKINS-51247 Amending instructions to reflect flatten-maven-plugin configuration change Compare: https://github.com/jenkinsci/incrementals-tools/compare/451599508e71...504d389e029a * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          .mvn/extensions.xml
          pom.xml
          http://jenkins-ci.org/commit/jenkins/51e0da8ed23d56eb85882937b9a96b7c4aa3c542
          Log:
          JENKINS-51247 source:jar, not source:jar-no-fork

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: .mvn/extensions.xml pom.xml http://jenkins-ci.org/commit/jenkins/51e0da8ed23d56eb85882937b9a96b7c4aa3c542 Log: JENKINS-51247 source:jar, not source:jar-no-fork

          Code changed in jenkins
          User: Jesse Glick
          Path:
          .gitignore
          .mvn/extensions.xml
          pom.xml
          http://jenkins-ci.org/commit/jenkins/41c2c49443b442e92e4ec76c001acdc213c4327d
          Log:
          Merge pull request #3431 from jglick/flatten

          JENKINS-51247 Simplified usage of flatten-maven-plugin

          Compare: https://github.com/jenkinsci/jenkins/compare/72f4a592d28d...41c2c49443b4
          *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

          Functionality will be removed from GitHub.com on January 31st, 2019.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: .gitignore .mvn/extensions.xml pom.xml http://jenkins-ci.org/commit/jenkins/41c2c49443b442e92e4ec76c001acdc213c4327d Log: Merge pull request #3431 from jglick/flatten JENKINS-51247 Simplified usage of flatten-maven-plugin Compare: https://github.com/jenkinsci/jenkins/compare/72f4a592d28d...41c2c49443b4 * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          .gitignore
          .mvn/extensions.xml
          pom.xml
          http://jenkins-ci.org/commit/artifact-manager-s3-plugin/ea314b978317326fdbc44ae3f8f0a51bda29b0c6
          Log:
          Merge pull request #21 from jglick/flatten

          JENKINS-51247 Simplified use of flatten-maven-plugin

          Compare: https://github.com/jenkinsci/artifact-manager-s3-plugin/compare/8f3e10aba6c8...ea314b978317
          *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

          Functionality will be removed from GitHub.com on January 31st, 2019.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: .gitignore .mvn/extensions.xml pom.xml http://jenkins-ci.org/commit/artifact-manager-s3-plugin/ea314b978317326fdbc44ae3f8f0a51bda29b0c6 Log: Merge pull request #21 from jglick/flatten JENKINS-51247 Simplified use of flatten-maven-plugin Compare: https://github.com/jenkinsci/artifact-manager-s3-plugin/compare/8f3e10aba6c8...ea314b978317 * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.

          Jesse Glick added a comment -

          Had to file jenkins PR 3441 as a hotfix for a release problem. Seems I need some other way to deal with the wrong basedir in Node executions.

          Jesse Glick added a comment - Had to file jenkins PR 3441 as a hotfix for a release problem. Seems I need some other way to deal with the wrong basedir in Node executions.

          Jesse Glick added a comment -

          This blog leads me to a workaround to edit the usage of source:jar from the superpom.

          Jesse Glick added a comment - This blog leads me to a workaround to edit the usage of source:jar from the superpom .

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          http://jenkins-ci.org/commit/pom/2ad60fbf2adcee40636cc522cc000a20c2302c35
          Log:
          JENKINS-51247 Always use source:jar, not source:jar-no-fork.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml http://jenkins-ci.org/commit/pom/2ad60fbf2adcee40636cc522cc000a20c2302c35 Log: JENKINS-51247 Always use source:jar, not source:jar-no-fork.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          http://jenkins-ci.org/commit/pom/c58c0c2a4753229a16284ffc9bf83385f6cb6b77
          Log:
          Merge pull request #25 from jglick/flatten-JENKINS-51247-source-fork

          JENKINS-51247 Always use source:jar-no-fork, not source:jar

          Compare: https://github.com/jenkinsci/pom/compare/4268dbd8740f...c58c0c2a4753
          *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

          Functionality will be removed from GitHub.com on January 31st, 2019.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml http://jenkins-ci.org/commit/pom/c58c0c2a4753229a16284ffc9bf83385f6cb6b77 Log: Merge pull request #25 from jglick/flatten- JENKINS-51247 -source-fork JENKINS-51247 Always use source:jar-no-fork, not source:jar Compare: https://github.com/jenkinsci/pom/compare/4268dbd8740f...c58c0c2a4753 * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          http://jenkins-ci.org/commit/plugin-pom/d535a304c6df0a8b008e833b61b9e9ff496d4ac7
          Log:
          JENKINS-51247 Always use source:jar, not source:jar-no-fork.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml http://jenkins-ci.org/commit/plugin-pom/d535a304c6df0a8b008e833b61b9e9ff496d4ac7 Log: JENKINS-51247 Always use source:jar, not source:jar-no-fork.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          http://jenkins-ci.org/commit/plugin-pom/832ee403ce0043c6101e00c4adb9a0e7c3e8eb19
          Log:
          Merge pull request #107 from jglick/flatten-JENKINS-51247-source-fork

          JENKINS-51247 Always use source:jar-no-fork, not source:jar

          Compare: https://github.com/jenkinsci/plugin-pom/compare/6772c3cbaf8b...832ee403ce00
          *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

          Functionality will be removed from GitHub.com on January 31st, 2019.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml http://jenkins-ci.org/commit/plugin-pom/832ee403ce0043c6101e00c4adb9a0e7c3e8eb19 Log: Merge pull request #107 from jglick/flatten- JENKINS-51247 -source-fork JENKINS-51247 Always use source:jar-no-fork, not source:jar Compare: https://github.com/jenkinsci/plugin-pom/compare/6772c3cbaf8b...832ee403ce00 * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: