Skipping Angular Build in Maven | Generated by AI

Home 2025.10

Short answer: yes—you can skip the Angular/npm build, but not with a built-in flag like --skip-web. Use one of these approaches.

1) Exclude the web module in a multi-module build

If your Angular app is its own Maven module (e.g., web), just exclude it in the reactor:

mvn -pl '!web' -am clean package

Or build only the backend module:

mvn -pl :backend -am clean package

(-am builds any needed deps; the !web syntax excludes that module.)

2) Add a “skip frontend” property (works with frontend-maven-plugin or exec)

Guard the npm goals with a property and flip it from the command line.

POM (web module or parent):

<properties>
  <skip.frontend>false</skip.frontend>
</properties>

<build>
  <plugins>
    <!-- Example: com.github.eirslett:frontend-maven-plugin -->
    <plugin>
      <groupId>com.github.eirslett</groupId>
      <artifactId>frontend-maven-plugin</artifactId>
      <version>...your version...</version>
      <configuration>
        <skip>${skip.frontend}</skip>
      </configuration>
      <executions>
        <execution>
          <id>npm-build</id>
          <phase>prepare-package</phase>
          <goals>
            <goal>npm</goal>
          </goals>
          <configuration>
            <arguments>run build</arguments>
          </configuration>
        </execution>
      </executions>
    </plugin>

    <!-- If you use exec-maven-plugin to call npm -->
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>exec-maven-plugin</artifactId>
      <version>...your version...</version>
      <executions>
        <execution>
          <id>npm-build</id>
          <phase>prepare-package</phase>
          <goals><goal>exec</goal></goals>
          <configuration>
            <skip>${skip.frontend}</skip>
            <executable>npm</executable>
            <arguments>
              <argument>run</argument>
              <argument>build</argument>
            </arguments>
          </configuration>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

CLI:

mvn -Dskip.frontend=true clean package

3) Use Maven profiles

Bind the frontend build only in a “with-frontend” profile and make a “skip-frontend” profile the default in dev.

POM:

<profiles>
  <profile>
    <id>with-frontend</id>
    <activation>
      <property>
        <name>!skip.frontend</name>
      </property>
    </activation>
    <build>
      <plugins>
        <!-- same plugin config as above, without skip -->
      </plugins>
    </build>
  </profile>
</profiles>

CLI:


Speed tips if you do build the UI


Bottom line

Use -pl '!web' to exclude the web module, or add a skip.frontend property and wire your plugin executions to respect it. There’s no standard mvn package --skip-web, but the two patterns above are reliable and common.


Back

openai/gpt-5

Donate