eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.26k stars 872 forks source link

How set variable version_app from pom.xml? #1137

Open jarekpc opened 8 months ago

jarekpc commented 8 months ago

Yes

Do you want to request a feature or report a bug?

What is the current behavior? How set variable version_app and build timestamp in frontend app export const environment = { production: false, version_app: '%VERSION%', build_date: '%BUILD_TIMESTAMP%', }; from pom.xml (e.g ${project.version} and ${maven.build.timestamp}) using https://github.com/eirslett/frontend-maven-plugin (in old application12 using plugin) and replace variable from pom to angular app `

com.google.code.maven-replacer-plugin
    <artifactId>replacer</artifactId>
    <version>1.5.3</version>
    <executions>
      <execution>
        <phase>prepare-package</phase>
        <goals>
          <goal>replace</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <filesToInclude>${basedir}/src/main/angular/dist/main-*.js</filesToInclude>
      <replacements>
        <replacement>
          <token>%VERSION%</token>
          <value>${project.version}</value>
        </replacement>
        <replacement>
          <token>%BUILD_TIMESTAMP%</token>
          <value>${maven.build.timestamp}</value>
        </replacement>
      </replacements>
    </configuration>
  </plugin>`

 and this worked 
  but when update application to angular 16 i don't see main file with variable version_app and build timestamp.
  How resolve this problem?

If the current behavior is a bug, please provide the steps to reproduce. mvn clean package

What is the expected behavior? I want to repleace version_app and build timestamp in angular application from java application(pom.xml)

Please mention your frontend-maven-plugin and operating system version. Java 17, spring boot 2.7.8, angular 16, windows 10