Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven-release-plugin and builder-helper plugin


I guess i am missing something..
I want to make a release of my project.
I added maven-release-plugin to my pom. In addition, i have another source code dir aside from java(call it gen-src). When i make the first steps in the maven release (i.e prepare) everything is ok, but when i make perform it does not take the gen-src in account.

<plugin>
       <groupId>org.codehaus.mojo</groupId>
      <artifactId>build-helper-maven-plugin</artifactId>
      <version>1.7</version>
       <executions>
          <execution>
               <id>add-source</id>
               <phase>generate-sources</phase>

               <goals>
                  <goal>add-source</goal>
               </goals>
               <configuration>
                   <sources>
                        <source>src/main/gen_src</source>
                   </sources>
               </configuration>
          </execution>
       </executions>
    </plugin>

I suspect that it may be connected to the fact that the phase is generated-sources. Do i need to attach the add-source goal to another phase? If yes, how?
I also read in here - this is similar problem though i am not using flex..no answer. Any idea?
Thanks.

like image 707
ronk Avatar asked Nov 14 '22 20:11

ronk


1 Answers

I had the same problem in the past and I think I know what's happening. The release:perform phase checkouts a copy of the tag to be released to 'target/checkout' folder and fork a maven process to build this checkout. As you have a problem only in the release:perform phase, it must be related to the fact that maven in running a fork process on the 'target/checkout' folder, not in the './' folder.

I ended up fixing this problem removing build helper, but I don't know if you could do the same, so if I were you I would try avoiding relative paths on configurations. You can configure the build-helper like that:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>build-helper-maven-plugin</artifactId>
  <version>1.7</version>
   <executions>
      <execution>
           <id>add-source</id>
           <phase>generate-sources</phase>

           <goals>
              <goal>add-source</goal>
           </goals>
           <configuration>
               <sources>
                    <source>${basedir}/src/main/gen_src</source>
               </sources>
           </configuration>
      </execution>
   </executions>
</plugin>

Defining explicitly the ${basedir} could avoid this problem because ${basedir} will resolve to the fork path (your_workspace/project/target/checkout) instead of the current path (your_workspace/project). If this doesn't fix the problem, I believe we should file a bug against build-helper-maven-plugin because there should be no errors only in the perform phase.

like image 141
BrunoJCM Avatar answered Dec 09 '22 10:12

BrunoJCM