Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend-maven-plugin: checksum computation is missing some frontend ressources #10612

Open
murdos opened this issue Aug 19, 2024 · 3 comments
Open

Comments

@murdos
Copy link
Contributor

murdos commented Aug 19, 2024

The frontend-maven-plugin module setup the checksum-maven-plugin to compute the checksum of frontend resources, and avoid running again all npm tasks (build and tests).

However the list of resources is incomplete, and is missing at least:

  • src/test/webapp/**/*.*
  • tsconfig.build.json
  • vite.config.ts
  • vitest.config.ts
  • specific angular configuration files?
  • ...
@murdos
Copy link
Contributor Author

murdos commented Aug 19, 2024

If we don't want to include tests resources, and only skip frontend build, we should use a dedicated maven property (e.g. skip.frontend.build) that would not prevent other npm tasks to run (such as npm test):

<plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>${maven-antrun-plugin.version}</version>
        <executions>
          <execution>
            <id>eval-frontend-checksum</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <condition else="false" property="skip.frontend.build" value="true">

and

      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>${frontend-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>npm install</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <configuration>
              <skip>${skip.frontend.build}</skip>
            </configuration>
          </execution>
          <execution>
            <id>build front</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>npm</goal>
            </goals>
            <configuration>
              <skip>${skip.frontend.build}</skip>
              <arguments>run build</arguments>
              <environmentVariables>
                <APP_VERSION>${project.version}</APP_VERSION>
              </environmentVariables>
              <npmInheritsProxyConfigFromMaven>false</npmInheritsProxyConfigFromMaven>
            </configuration>
          </execution>

@pascalgrimaud
Copy link
Member

pascalgrimaud commented Aug 20, 2024

What do you think about extracting this logic into a dedicated module, instead of keeping in frontend-maven-plugin module ?
So we could have new specific modules, dedicated to each front ?

@murdos
Copy link
Contributor Author

murdos commented Aug 20, 2024

This is a good idea! This would also make this checksum logic optional: you can add it only when you need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants