Skip to content

Instantly share code, notes, and snippets.

@sterlp
Last active September 18, 2023 13:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sterlp/213d37ebd83d3cc8d0a43993f36d62b5 to your computer and use it in GitHub Desktop.
Save sterlp/213d37ebd83d3cc8d0a43993f36d62b5 to your computer and use it in GitHub Desktop.
Angular Integration into maven build, CLEAN, INSTALL, TEST
<build>
<sourceDirectory>src/app</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
</resource>
<resource>
<directory>e2e</directory>
</resource>
</resources>
<!-- DELETE everything in case of maven clean -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>dist</directory>
</fileset>
<fileset>
<directory>node_modules</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- INSTALL everything -->
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>3.0.0</version>
<executions>
<execution>
<id>npm install</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<!-- BUILD Web Jar for Spring Boot -->
<execution>
<id>angular-cli build</id>
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<configuration>
<executable>ng</executable>
<arguments>
<argument>build</argument>
<argument>--base-href</argument>
<argument>/ui/</argument>
<argument>--output-path</argument>
<argument>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}</argument>
</arguments>
</configuration>
</execution>
<!-- RUN TESTS -->
<execution>
<id>angular-cli test</id>
<goals>
<goal>exec</goal>
</goals>
<phase>test</phase>
<configuration>
<executable>ng</executable>
<arguments>
<argument>test</argument>
<argument>--watch=false</argument>
<argument>--code-coverage</argument>
<argument>--browsers=ChromeHeadless</argument>
<!--
<argument>--no-sandbox</argument>
-->
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment