Skip to content

Instantly share code, notes, and snippets.

@pramoth
Last active January 28, 2018 18:22
Show Gist options
  • Select an option

  • Save pramoth/0e13b21989f7f7388797fc3df99c5478 to your computer and use it in GitHub Desktop.

Select an option

Save pramoth/0e13b21989f7f7388797fc3df99c5478 to your computer and use it in GitHub Desktop.
<profile>
<id>prod</id>
<properties>
<spring.profiles.active>prod</spring.profiles.active>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<!-- อันนี้คือ npm install -->
<execution>
<id>npm install</id>
<goals>
<goal>exec</goal>
</goals>
<phase>initialize</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
<workingDirectory>${project.basedir}/src/main/web</workingDirectory>
</configuration>
</execution>
<execution>
<!-- อันนี้คือ ng build --prod แต่ว่ารันผ่าน node เนื่องจากต้องการแรมเพิ่ม-->
<id>ng build</id>
<goals>
<goal>exec</goal>
</goals>
<phase>initialize</phase>
<configuration>
<executable>node</executable>
<arguments>
<!-- อันนี้สำหรับ project ที่ใหญ่ ต้องใช้ mem เยอะหน่อย ปกติก็ไม่จำเป็นถ้าไม่ out of mem-->
<argument>--max_old_space_size=3048</argument>
<!-- ไม่ต้องติดตั้ง ng cli ในเครื่องนะครับ จะได้ portable รันใน node_modules เลย -->
<argument>./node_modules/.bin/ng</argument>
<argument>build</argument>
<argument>--prod</argument>
</arguments>
<workingDirectory>${project.basedir}/src/main/web</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment