Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
pom.xml 5.35 KiB
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>eu.europa.ec.edelivery</groupId>
    <artifactId>smp-modules</artifactId>
    <version>5.0</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <artifactId>smp-angular</artifactId>
  <packaging>jar</packaging>
  <name>SMP Angular UI</name>

  <properties>
    <!-- Only selected modules are deployed -->
    <maven.deploy.skip>false</maven.deploy.skip>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <!--  Currently last version not supported by the build server :(
    node.version>v18.13.0</node.version>
    <npm.version>8.19.3</npm.version -->
    <node.version>v16.20.0</node.version>
    <npm.version>8.19.4</npm.version>

    <!--
    set variable to force use of pre-installed npm-->
    <!-- To build  with preinstalled nodejs build with usePreInstalledNpm argument as example
    (works only on linux for Windows update arguments in exec plugin below)
    mvn clean install -DusePreInstalledNpm -Dnpm.path=/opt/programs/node-v14.17.0-linux-x64/bin
    -->
    <!--suppress UnresolvedMavenProperty -->
    <npm.path>${env.bamboo_CITNET_NODEJS_16_LINUX_PATH}</npm.path>
  </properties>


  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>./src/main/resources/META-INF/resources</directory>
              <includes>
                <include>**/*</include>
              </includes>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
    </plugins>
  </build>


  <profiles>
    <profile>
      <id>defaultInstallNpm</id>
      <activation>
        <property>
          <name>!usePreInstallNpm</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>install node and npm</id>
                <goals>
                  <goal>install-node-and-npm</goal>
                </goals>
                <configuration>
                  <nodeVersion>${node.version}</nodeVersion>
                  <npmVersion>${npm.version}</npmVersion>
                </configuration>
              </execution>
              <execution>
                <id>npm install</id>
                <goals>
                  <goal>npm</goal>
                </goals>
                <configuration>
                  <arguments>install --unsafe-perm</arguments>
                </configuration>
              </execution>
              <execution>
                <id>prod</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>npm</goal>
                </goals>
                <configuration>
                  <arguments>run-script prod</arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>usePreInstalledNpm</id>
      <activation>
        <property>
          <name>usePreInstallNpm</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>npm install</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <arguments>
                    <argument>${npm.path}/npm</argument>
                    <argument>install</argument>
                    <argument>@angular/cli</argument>
                  </arguments>
                </configuration>
              </execution>

              <execution>
                <id>angular build</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <arguments>
                    <argument>${npm.path}/npm</argument>
                    <argument>run-script</argument>
                    <argument>prod</argument>
                  </arguments>
                </configuration>

              </execution>
            </executions>
            <configuration>
              <executable>${npm.path}/node</executable>
            </configuration>
            <!--configuration>
              <executable>${npm.path}/node</executable>
              <arguments>
                <argument>${npm.path}/npm</argument>
                <argument>run-script</argument>
                <argument>prod</argument>
              </arguments>
            </configuration-->
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>