我想使用 Maven 构建 Angular2 TypeScript 项目。有没有一种方法可以包裹npm install
or ng build
里面的命令pom.xml
文件?我只是想构建那个项目。
您可以像这样简单地使用。我在我的应用程序中已经这样做了。这是最简单的一个。
安装nodejs并使其在类路径中可用。
并全局安装 Angular CLI。
npm install -g @angular/cli
写一个简单的脚本run.sh
npm install
ng build
现在使用maven exec插件来调用脚本。当您调用 Maven install/deploy 时,它会经历此生命周期并构建您的 Angular 项目。
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.2.1</version>
<executions>
<execution>
<id>Build angular using ng</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/build.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)