Frontend maven plugin

<plugins>
    <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <!-- Use the latest released version:
        https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
        <version>0.0.27</version>
        ...

</plugin>

maven call the package.json file's script part:

 {
 "name": "npm-to-maven-adapator",
 "version": "0.0.1-SNAPSHOT",
 "description": "Example of node project with maven build scripts",
 "private": true,
 "scripts": {
 "clean": "node node_modules/gulp/bin/gulp.js --no-color clean",
"build": "node node_modules/gulp/bin/gulp.js --no-color build",
"test": "node node_modules/gulp/bin/gulp.js --no-color test",
"prepare-for-maven-war": "node node_modules/gulp/bin/gulp.js --no-color prepare-for-maven-war"
 },
 "devDependencies": {
 "del": "^1.1.1",
 "gulp": "^3.8.11",
 "gulp-util": "^3.0.1",
 "mkdirp": "^0.5.0",
 "touch": "0.0.3",
 "yargs": "^1.3.3"
 }
 }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
如果您使用frontend-maven-plugin打包的jar文件中没有static文件夹,那可能是因为frontend-maven-plugin默认不会将静态资源文件包含在打包的jar文件中。为了解决这个问题,您可以尝试以下步骤: 1. 在您的Vue项目的根目录下创建一个名为`static`的文件夹,并将您的静态资源文件放置在其中。 2. 在您的Vue项目的根目录下创建一个名为`.npmrc`的文件,并添加以下内容: ``` prefix=${project.basedir}/target/${project.build.finalName}/static ``` 这将告诉frontend-maven-plugin将静态资源文件复制到打包的jar文件中的正确位置。 3. 更新您的pom.xml文件中frontend-maven-plugin插件的配置,确保它包含`copy`目标,并将`copy`目标的`outputDirectory`设置为`${project.build.directory}/${project.build.finalName}/static`。示例如下: ```xml <plugin> <groupId>com.github.eirslett</groupId> <artifactId>frontend-maven-plugin</artifactId> <version>1.12.0</version> <executions> <!-- 其他执行目标 --> <!-- ... --> <!-- 添加 copy 目标 --> <execution> <id>copy files</id> <goals> <goal>copy</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/${project.build.finalName}/static</outputDirectory> <resources> <resource> <directory>static</directory> <includes> <include>**/*</include> </includes> </resource> </resources> </configuration> </execution> </executions> </plugin> ``` 4. 重新运行`mvn clean install`命令来重新打包您的应用。这将确保静态资源文件被正确地复制到打包的jar文件中的static文件夹中。 现在,您应该能够在打包后的jar文件中找到static文件夹并包含您的静态资源文件。请确保在使用这些静态资源文件时,使用正确的路径引用它们。 希望这能解决您的问题!如有其他疑问,请随时追问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值