Search code examples
maventychomaven-bom

installAtEnd and deployAtEnd are Not Executed at End of Build


I have a multi-module project with a structure like this:

  • build
    • module
    • module.bom
    • rcp.build
      • module.rcp

Both build projects where separate before and worked. Now that I put them together installAtEnd and deployAtEnd do not work. I added them like this:

    <plugin>
      <artifactId>maven-install-plugin</artifactId>
      <version>2.5.2</version>
      <configuration>
        <installAtEnd>true</installAtEnd>
      </configuration>
    </plugin>
    <plugin>
      <artifactId>maven-deploy-plugin</artifactId>
      <version>2.8.2</version>
      <configuration>
        <deployAtEnd>true</deployAtEnd>
      </configuration>
    </plugin>

I did not configure the plug-ins beyond the above. Still whenever I run the build I get the following log:

[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ module.rcp ---
[INFO] Installing group:module.rcp:0.1.6-SNAPSHOT at end
[INFO] 
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ module.rcp ---
[INFO] Deploying group:module.rcp:0.1.6-SNAPSHOT at end
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] modules ............................................. SUCCESS [  3.339 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:05 min
[INFO] Finished at: 2019-01-18T12:54:18+01:00
[INFO] ------------------------------------------------------------------------

Maven forgot to install / deploy.

I found this bug and this question, which suggest it might be due to Tycho. So I added the Tycho plug-ins to the parent pom.xml which did nothing. Then I removed the RCP module entirely. Still the same problem.

Now the BOM still has a parent that is not the Maven project "build", and removing it / changing the parent makes the build install and deploy correctly. However since it's a BOM I can't use the "build" parent.

Is there any other way to get installAtEnd and deployAtEnd to work in my project structure?


Solution

  • As khmarbaise pointed out, the following Maven extension can be used: https://github.com/khmarbaise/maven-deployer-extension

    Note that this approach won't work on a Jenkins, since it doesn't support Maven core extensions. (I'd say "yet", but JENKINS-30058 is a 4 year old blocker bug, so I suppose it's not going to be fixed any time soon.) If the build should work on Jenkins, too, there seems to be no other option than either disabling deployAtEnd and installAtEnd or to remove the second parent POM from the modules.


    Today I found another reason for the build to not deploy while maintaining an older project. There was something like this:

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
    

    Removing the <extensions> made the project deploy again.