Skip to content

Instantly share code, notes, and snippets.

@TheAnonymous
Last active August 10, 2017 07:45
Show Gist options
  • Save TheAnonymous/a79fc964a9dca8b9692570b5dbb7c676 to your computer and use it in GitHub Desktop.
Save TheAnonymous/a79fc964a9dca8b9692570b5dbb7c676 to your computer and use it in GitHub Desktop.
Example for Maven + Node stuff
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>delete email stuff</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<filesets>
<fileset>
<directory>node_modules</directory>
<includes>
<include>**/**</include>
</includes>
</fileset>
</filesets>
</configuration>
</execution>
<!--
<execution>
<id>delete vuejs stuff from vuejs folder</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<filesets>
<fileset>
<directory>src/main/vuejs</directory>
<includes>
<include>dist/**/**</include>
<include>node_modules/**/**</include>
<include>node/**/**</include>
</includes>
</fileset>
</filesets>
</configuration>
</execution>
-->
<execution>
<id>delete vuejs stuff from static folder</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<filesets>
<fileset>
<directory>src/main/resources/static/static</directory>
<includes>
<include>**/**</include>
</includes>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<!-- Use the latest released version:
https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
<version>1.4</version>
<configuration>
<nodeVersion>v7.10.0</nodeVersion>
<npmVersion>4.2.0</npmVersion>
<yarnVersion>v0.27.5</yarnVersion>
<triggerfiles>
<triggerfile>gulpfile.js</triggerfile>
<triggerfile>package.json</triggerfile>
</triggerfiles>
</configuration>
<executions>
<!-- GULP STUFF FOR EMAILS JS -->
<execution>
<!-- optional: you don't really need execution ids,
but it looks nice in your build log. -->
<id>install_node_npm_gulp</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<!-- optional: default phase is "generate-resources" -->
<phase>generate-resources</phase>
</execution>
<execution>
<id>install_packages_gulp</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>run_gulp</id>
<goals>
<goal>gulp</goal>
</goals>
<!-- optional: the default phase is "generate-resources" -->
<phase>generate-resources</phase>
<configuration>
<!-- optional: if not specified, it will run gulp's default
task (and you can remove this whole <configuration> section.) -->
<arguments>build</arguments>
</configuration>
</execution>
<!-- VUE JS -->
<execution>
<!-- optional: you don't really need execution ids,
but it looks nice in your build log. -->
<id>install_node_npm_vuejs</id>
<goals>
<goal>install-node-and-yarn</goal>
</goals>
<!-- optional: default phase is "generate-resources" -->
<phase>generate-resources</phase>
<configuration>
<installDirectory>src/main/vuejs</installDirectory>
</configuration>
</execution>
<!--
<execution>
<id>clear_packages_vuejs</id>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>cache clear</arguments>
<workingDirectory>src/main/vuejs</workingDirectory>
</configuration>
</execution>
-->
<execution>
<id>install_packages_vuejs</id>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>install</arguments>
<workingDirectory>src/main/vuejs</workingDirectory>
</configuration>
</execution>
<execution>
<id>run_build_vuejs</id>
<goals>
<goal>yarn</goal>
</goals>
<!-- optional: the default phase is "generate-resources" -->
<phase>generate-resources</phase>
<configuration>
<!-- optional: if not specified, it will run gulp's default
task (and you can remove this whole <configuration> section.) -->
<arguments>run build</arguments>
<workingDirectory>src/main/vuejs</workingDirectory>
<triggerfiles>
<triggerfile>package.json</triggerfile>
</triggerfiles>
<environmentVariables>
<NODE_ENV>production</NODE_ENV>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
<!-- COPY VUE JS STUFF TO GET SERVED WITH SPRING -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>copy index.html of vuejs</id>
<phase>generate-resources</phase>
<configuration>
<target>
<copy file="${project.basedir}/src/main/vuejs/dist/index.html"
tofile="${project.basedir}/src/main/resources/public/vuejs/index.html"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>copy js files from vuejs</id>
<phase>generate-resources</phase>
<configuration>
<target>
<copy todir="${project.basedir}/src/main/resources/static">
<fileset dir="${project.basedir}/src/main/vuejs/dist/">
<include name="**/*.*"/> <!--NOTE DIFFERENCE HERE-->
</fileset>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment