maven-release-plugin and git submodules


References

Problem

src/main/java 아래에 특정 폴더가 submodule 로 처리된 프로젝트를 평소와 같이 릴리즈 하였다.

$ git checkout -b release/test
$ mvn release:prepare release:perform
...
[INFO] Nothing to compile - all classes are up to date
...
$ 

target/checkout 폴더에서 submodule이 init 되지 않은 채 그대로 처리된다.

Solution

위 링크에서 제시된 해결책을 사용하여 해결하였다.

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <inherited>false</inherited> <!-- only execute these in the parent -->
  <executions>
    <execution>
      <id>git submodule update</id>
      <phase>initialize</phase>
      <configuration>
        <executable>git</executable>
        <arguments>
          <argument>submodule</argument>
          <argument>update</argument>
          <argument>--init</argument>
          <argument>--recursive</argument>
        </arguments>
      </configuration>
      <goals>
        <goal>exec</goal>
      </goals>
    </execution>
  </executions>
</plugin>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s