ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

若依前后端打包成jar运行

若依前后端打包成jar运行 前端修改1.修改前端路由 src/router/index.js修改前mode: history, 修改后mode: hash,2.修改打包部署根路径 .env.production修改前VUE_APP_BASE_API /prod-api 修改后VUE_APP_BASE_API /后端修改1.修改 admin 模块里面的 com/web/controller/system/SysIndexController.java修改前 RestController RequestMapping(/) return StringUtils.format(欢迎使用{}后台管理框架当前版本v{}请通过前端地址访问。, ProjectConfig.getName(), ProjectConfig.getVersion()); 修改后 Controller RequestMapping(value {/, /index}) return redirect:/index.html;2.修改 framework 模块里面的 com/framework/config/SecurityConfig.java修改前 .antMatchers(HttpMethod.GET, /, /*.html, /**/*.html, /**/*.css, /**/*.js, /profile/**).permitAll() .antMatchers(/swagger-ui.html, /swagger-resources/**, /webjars/**, /*/api-docs, /druid/**).permitAll() 修改后 .antMatchers(HttpMethod.GET, /,/index, /*.html, /**/*.html, /**/*.ico, /**/*.css, /**/*.js, /profile/**).permitAll() .antMatchers(HttpMethod.GET,/static/**).permitAll() .antMatchers(/swagger-ui.html, /swagger-resources/**, /webjars/**, /*/api-docs, /druid/**).permitAll()3.配置添加plugin到 admin 模块中的 pom.xml 里面的buildplugins节点下面保证打包的时候复制 dist 里面的内容到 resources 中的 static 里面plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-resources-plugin/artifactId version3.2.0/version executions execution idcopy-frontend-resources/id phaseprocess-resources/phase goals goalcopy-resources/goal /goals configuration outputDirectory${project.build.outputDirectory}/static/outputDirectory resources resource directory${project.basedir}/../vue/dist/directory filteringfalse/filtering /resource /resources /configuration /execution /executions /plugin4.配置添加plugin到父 pom.xml 里面的buildplugins节点下面保证打包之前先打包 vue 项目生成 dist 文件夹plugin groupIdorg.codehaus.mojo/groupId artifactIdexec-maven-plugin/artifactId version3.1.0/version inheritedfalse/inherited executions execution idexec-npm-build/id phaseprepare-package/phase goals goalexec/goal /goals configuration workingDirectory${session.executionRootDirectory}/ruoyi-ui/workingDirectory executablenpm/executable arguments argumentrun/argument argumentbuild:prod/argument /arguments /configuration /execution /executions /plugin
返回列表