You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Niels Basjes (Jira)" <ji...@apache.org> on 2022/02/06 15:48:00 UTC

[jira] [Commented] (MRELEASE-798) Commit additional files with release plugin

    [ https://issues.apache.org/jira/browse/MRELEASE-798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17487720#comment-17487720 ] 

Niels Basjes commented on MRELEASE-798:
---------------------------------------

Although my approach is not perfect this approach may still be of interest to some people as it can be used with the currently released version of the release plugin.

Important:
- This does NOT handle rollback of the generated file at all. You must handle that manually if this happens.
- I use git, I have not tested this under different systems.

I noticed that the prepare does a {{git add}} of all the pom.xml files and the later a {{git commit}} of everything that was added.
So my approach is to simple do a {{git add}} when generating a file I want to be added.

{code:xml}
<properties>
  <documentationVersionFile>layouts/shortcodes/WebsiteProjectVersion.md</documentationVersionFile>
</properties>
{code}

{code:xml}
<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>exec-maven-plugin</artifactId>
      <version>3.0.0</version>
      <executions>
        <execution>
          <id>Set released version in website</id>
          <phase>generate-resources</phase>
          <goals>
            <goal>exec</goal>
          </goals>
          <configuration>
            <executable>sh</executable>
            <arguments>
              <argument>-c</argument>
              <argument>echo -n ${project.version} &gt; ${project.basedir}/${documentationVersionFile} ; exit 0</argument>
            </arguments>
          </configuration>
        </execution>
      </executions>
    </plugin>

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-scm-plugin</artifactId>
      <version>2.0.0-M1</version>
      <executions>
        <execution>
          <id>Add generated files to next commit</id>
          <phase>generate-resources</phase>
          <goals><goal>add</goal></goals>
          <configuration>
            <includes>${documentationVersionFile}</includes>
          </configuration>
        </execution>
      </executions>
    </plugin>

  </plugins>
</build>
{code}


> Commit additional files with release plugin
> -------------------------------------------
>
>                 Key: MRELEASE-798
>                 URL: https://issues.apache.org/jira/browse/MRELEASE-798
>             Project: Maven Release Plugin
>          Issue Type: Improvement
>          Components: prepare, scm
>    Affects Versions: 2.3.2
>            Reporter: Thorsten Hoeger
>            Priority: Major
>              Labels: github-pullrequest
>         Attachments: maven-release-2.4.1-additionalCommitted.patch
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Hi,
> is there any possibility to have the release-plugin commit additional files which were
> generated/modified in the preparationGoals.
> Now only the pom.xml is commited. Using scm-plugin has some serious drawbacks in this
> situation.
> If it is not possible at the moment, is there any chance to get this in the future. Maybe
> there could be a parameter additionalCommitFiles with a list of files to commit along with
> pom.xml.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)