1

We are using the frontend-maven-plugin in several (10+) projects. These projects are build in combination with our own CMS. These projects are using a specific 'parent' in the pom, such as:

<parent>
    <groupId>nl.companyname</groupId>
    <artifactId>companyname-corporate-pom</artifactId>
    <version>2.0.13</version>
</parent>

In this 'corporate pom', we have some predefined configuration and 'plugin management', such as:

<project.frontendmavenplugin.version>1.3</project.frontendmavenplugin.version>
    <project.frontendmavenplugin.workingDirectory>./</project.frontendmavenplugin.workingDirectory>

    <project.node.downloadRoot>http://nodejs.COMPANYURL.nl/dist/</project.node.downloadRoot>
    <project.node.version>v6.9.1</project.node.version>

    <project.yarn.version>v0.17.9</project.yarn.version>
    <project.yarn.downloadRoot>http://yarnpkg.COMPANYURL.nl/</project.yarn.downloadRoot>
    <project.npm.registryUrl>http://nexus.COMPANYURL.nl/content/groups/npm-all/</project.npm.registryUrl>

and

<build>
    <pluginManagement>
        <!-- Generic configuration for plugins used by (almost) all projects. -->
        <plugins>
<plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>${project.frontendmavenplugin.version}</version>
                <executions>

                    <execution>
                        <id>install node and yarn</id>
                        <goals>
                            <goal>install-node-and-yarn</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <workingDirectory>${project.frontendmavenplugin.workingDirectory}</workingDirectory>
                            <nodeVersion>${project.node.version}</nodeVersion>
                            <nodeDownloadRoot>${project.node.downloadRoot}</nodeDownloadRoot>
                            <yarnVersion>${project.yarn.version}</yarnVersion>
                            <yarnDownloadRoot>${project.yarn.downloadRoot}</yarnDownloadRoot>
                        </configuration>
                    </execution> 

etc.

This way we don't have to copy/manage all configuration in each project. This works great.

But: we are now also creating more and more new applications (based on Spring Boot) which are independent from our CMS and where we cannot use this 'parent pom' because Spring Boot has it's own (spring-boot-starter-parent) and our 'corporate pom' also contains very specific plugins / configuration which only applies to our CMS (which we are not including in these Spring Boot projects).

So what I need is something more 'standalone' for the frontend-maven-plugin configuration (and maybe in the future more 'platform' independent config/plugins). As far as I know, it's not possible to have more then 1 parent, so are there any other options? I thought of creating a new 'companyname-frontend-maven-plugin' which both contains the PluginManagement as all the (extendable) configuration for the Frontend Maven Plugin. But I don't know if this will work and also it's a lot of work creating and maintaining this in git / Jenkins etc. Are there any other options I could look in to?

Thank you all for your time!

NickGreen
  • 1,742
  • 16
  • 36
  • Have a look there: https://stackoverflow.com/questions/21317006/spring-boot-parent-pom-when-you-already-have-a-parent-pom – Tome Jan 08 '18 at 16:40
  • @Tome Thanks, looks interesting, but reading the answer https://stackoverflow.com/a/47954088/639033 - it seems going with this solution, I need to copy a fair amount of Spring Boot relating stuff in to each Spring Boot project. The goal is: less duplication. I don't think this is the best fit? – NickGreen Jan 09 '18 at 08:27
  • 1
    Until Maven have mixins (https://issues.apache.org/jira/browse/MNG-5102), I don't know about an existing less-duplication solution. – Tome Jan 09 '18 at 09:18
  • Thanks. Looking at the issues activity, it doesn't seem to have any priority anymore. I voted / commented though. The thread is mentioning https://github.com/maoo/maven-tiles/ which seems interesting, but looks like it's not maintained anymore (and still in beta). – NickGreen Jan 22 '18 at 16:17
  • You can import the spring boot dependencies via import into the dependencyManagement and than use it...You don't need to use the spring boot parent... – khmarbaise Jan 22 '18 at 16:29

1 Answers1

0

maybe you can use a profile. You can create a "corporate" pom that inherit from spring-boot-starter-parent and that contains a maven profile with all the properties and plugins required by your cms. So, when you are working on the CMS you will enable the "cms-profile".

Kind regards.

gdegani
  • 846
  • 6
  • 17
  • It looks interesting, reading http://maven.apache.org/guides/introduction/introduction-to-profiles.html but I don't think it's perfect fit for my issue? Because the 'CMS projects' are not Spring Boot and the Spring Boot projects, doesn't use the CMS, how can I use one corporate pom for both? – NickGreen Jan 09 '18 at 08:21