使用maven 打包springboot项目后 没有配置文件(没resources下的文件)的解决办法

成功解决 Plugin ‘org.springframework.boot:spring-boot-maven-plugin:‘ not found Plugin 'org.springframework.boot:spring-boot-maven-plugin:' not found 解决方案 阅读详情

使用maven打包springboot项目 打包后运行发现 启动报错找不到数据库配置或者 配置文件压根并没有生效  打开jar包里检查 发现根本就没有自己写的配置文件..这问题就是在使用maven打包时 pom里缺少配置

具体在pom配置文件中按需要加上下边配置即可

<!--设置对应生成的xml文件路径??-->
<resources>
    <resource>
        <directory>src/main/java</directory>
        <includes>
            <include>**/*.xml</include>
        </includes>
    </resource>
    <!--设置自己目录下的配置文件-->
    <resource>
      <!--下方resources的文件夹名字要和自己项目的文件夹名确认一致才行 很多人就是忽略了名字不一致 -->
        <directory>src/main/resources</directory>
        <includes>
            <include>**/*</include>
        </includes>
    </resource>
</resources>

pom里 resources的文件夹名字要和自己项目的文件夹名确认一致才行 很多人就是忽略了名字不一致

 

SpringBoot打包将jar包与lib依赖、配置文件分开 它可以从 Maven 仓库中下载依赖项、解析依赖树、复制依赖项到指定目录等。它提供了许多与依赖项相关的功能,例如生成依赖报告、分析依赖冲突等。它会将编译好的类文件、资源文件等打包到 JAR 文件中,并可以配置主类、依赖项、过滤规则等。:该插件用于处理项目的资源文件。properties标签中定义项目保存目录、依赖的输出目录、jar包的输出目录、resources中配置文件的输出目录、编码格式。在打包阶段使用,将项目的编译输出文件打包为 JAR 文件。可以在构建的不同阶段使用,用于管理和处理项目的依赖项。 阅读详情

相关推荐

四、嘉立创EDA原理图绘制实战:从零搭建STM32温湿度监测系统

本文详细介绍了使用嘉立创EDA标准版从零开始绘制STM32温湿度监测系统原理图的完整流程。涵盖核心元器件选型、电源电路设计、ADC按键创新应用及模块化布局技巧,帮助电子爱好者快速掌握STM32系统设计,提升嵌入式开发实战能力。

h0i1j2k3l的博客 883

Spring Boot打成jar包后运行及配置文件的问题

Spring Boot项目可以有多个不同的配置文件,application.yml、application-dev.yml、application-test.yml等。反复检查项目的配置文件,application.yml指定的就是dev,但是为什么运行jar包就变成test了呢?显然比较麻烦,而且每次导入项目都得重新添加一次。例如这里指定的是dev,那么就会读取application-dev.yml文件配置。在jar包外面的application.yml文件居然优先起了作用,也是无语了。

xinxin_2011的博客 3690

西门子1200PLC编程实战:OB、FC、FB与DB的深度解析与应用技巧

本文深度解析西门子1200PLC编程中OB、FC、FB与DB四大核心功能块的应用技巧。通过工厂化比喻,阐明OB作为程序总调度、FC作为可重用函数、FB作为带记忆的智能设备以及DB作为数据仓库的角色与关系,并提供实战技巧,帮助工程师构建结构清晰、易于维护的高效PLC程序。

weixin_29280657的博客 440

解决Springboot项目打成jar包后获取resources目录下的文件报错的问题

前几天在项目读取resources目录下的文件时碰到一个小坑,明明在本地是可以正常运行的,但是一发到测试环境就报错了,说找不到文件,报错信息是:class path resource [xxxx] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:xxxx.jar!xxxx。看了半天代码感觉没有问题,于是怀疑是打成项目jar包后和原项目存在差异导致的。

Gefangenes的博客 7074

1173:阶乘和

1173:阶乘和 时间限制: 1000 ms 内存限制: 65536 KB 提交数: 6010 通过数: 3049 【题目描述】 用高精度计算出S=1!+2!+3!+…+n!(n≤50),其中“!”表示阶乘,例如:5!=5×4×3×2×1。 输入正整数n,输出计算结果S。 【输入】 一个正整数n。 【输出】 计算结果S。 【输入样例】 5 【输出样例】 153 思路: ...

zqhf123的博客 1260

自锁电路设计

Hi,uu们,是不是经常要用到自锁电路,通常不是使用555芯片就是用比较器来做自锁,今天我们来简单看下自锁电路的设计.图1采用了比较器构建了一个自锁电路,采用低电平复位,当需要复位的时候志需要将反向端的二极管拉低一下即可,免去 三极管控制同相端和电源短接的麻烦。图1:比较器构建的自锁电路也可以使用555去构建,如下图2所示.图2:使用555构建的自锁电路工作原理见555的真值表,真值表如表1所示.表1:555电路真值表相对来说555还是比较贵,所以我就想能不能有个便宜的方法做个自锁电路,构建电路如下图3所示

weixin_43884675的博客 7063

Maven@maven项目编译生成的target没有resource的配置文件

通过maven项目管理工具使用maven的webapp骨架快速创建springboot项目。

全局安装vue-cli之后,命令行执行vue -V,提示:“vue”不是内部或外部命令,也不是可执行的程序或批处理文件 1159

Changer: Feature Interaction Is What You Need forChange Detection

还有“交换“交互是一种完全不需要参数和计算的操作,它是通过交换空间或通道维度上的双时态特征映射来实现的,交换的特征在经过后续的卷积或令牌混合时进行混合。方法二:提出了两种简单的交互策略,AD和特征“交换”,大量的实验表明,它们可以极大地提高MetaChanger的性能,特别是特征“交换”,即使嵌入到复杂的网络中或应用于具有挑战性的数据集。在这里,我们用虚线勾勒本文的重点。这是变化检测任务的基本问题,双时相图像提供了同一地区在不同时间点的图像数据,通过对比这两个时间点的图像,我们可以检测出该地区的变化。

yokon的博客 1619

springboot 使用maven 打jar包发现没有resources下的所有配置文件

原因:下图两者的resource(resources)单词要一致,很多人都是少个s或多个s 的  

li_csdn_的博客 6645

Jetson Thor平台JP7.0版本96712 GMSL相机驱动调试记录

摘要:本文档记录了在Thor Custom Board (JP7.0GA)上配置GMSL摄像头时遇到的视频流问题及调试过程。问题表现为视频设备(/dev/video11)能正常创建,但获取视频时出现"Internal data stream error",而相同配置在AGX Orin JP6.0上运行正常。通过梳理硬件拓扑、v4l2-ctl测试、提升时钟频率及分析内核日志,发现VI引擎未接收到帧数据包。调试步骤包括检查设备树冲突、调整I2C总线配置、修正通道名称,最终通过屏蔽传感器启动时

jzwjzw19900922的博客 1109

容器化部署指南——Docker/K8s环境下的OpenClaw实践(附Dockerfile)

通过本文的详细指导,你已经掌握了OpenClaw在Docker和Kubernetes环境中的容器化部署方法。从基础镜像构建到高级部署策略,从开发环境到生产环境,你现在已经具备了完整的容器化部署能力。 容器化技术为OpenClaw提供了灵活、可扩展、可移植的部署方案,能够满足不同规模和需求的应用场景。通过合理使用Docker和Kubernetes,你可以实现高效的部署管理和运维自动化。 在实际应用中,建议根据具体的业务需求选择合适的部署策略,并结合监控、日志、安全等最佳实践,确保系统的稳定性和可靠性。同时

博客 493

关于springboot+maven中pom配置的一个坑

在用springboot+maven开发时用application.properties做配置文件,用ide启动配置文件生效,但是打成jar包之后在服务器上运行时配置一直不生效。 之前碰到过mybaits解析xml文件找不到的问题,是修改pom文件,碰到配置不生效时一开始以为是引入的jar包把配置覆盖了,后来看到pom文件时,意识到这个问题。就是在pom的&lt; build&gt;标签中加...

星辰一地的专栏 1854

【推荐100个unity插件】基于节点的程序化无限地图生成器 —— MapMagic 2

MapMagic 2是一款基于节点的程序化地形生成工具,可快速创建无限地图。主要功能包括:通过图形化节点编辑器构建地形逻辑;支持四个核心模块(对象、样条线、生物群落和笔刷);提供完整的操作指南,包括创建资产、使用编辑器窗口、节点操作等。工具具有直观的UI界面,支持节点连接、参数调整、图层管理等功能,并能实时生成地形。适合游戏开发者快速构建高质量的可玩地形环境。

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 3118

ideaxml文件全部变灰了_IDEA不编译src的java目录下的xml文件问题及解决

IDEA的maven项目中,默认源代码目录下(src/main/java目录)的xml等资源文件并不会在编译的时候一块打包进classes文件夹,而是直接舍弃掉。如果使用的是Eclipse,Eclipse的src目录下的xml等资源文件在编译的时候会自动打包进输出到classes文件夹。示例:当在IDEA中使用MyBatis时,一般会创建一个SQL映射的配置文件,这个文件如果是在src/main/...

weixin_42367464的博客 871

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

关于maven打包时, 资源文件没有被打包进来的问题

在之前的一篇文章mybatis看这一篇就够了当中,提到过,在使用mybatis时,有时候需要把编写了SQL语句的XML文件,和Java类文件放在一起,如 如果不加配置,用maven进行打包时,默认不会将src/main/java目录下的XML文件打包进去。因为src/main/java被设定为了源码目录,默认只会将其中的Java文件进行编译打包。 即,默认打包得到的结果如下 可以看到com.example.mp.mappers包下没有XML文件 我们可以配置pom.xml中的resources标签,指定

vcj1009784814的博客 1万+

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

SpringBoot分离打包:将jar包与lib依赖、配置文件分开

文章目录一、前言二、正文1.整个项目的目录结构2.系统环境变量配置3.pom文件配置——本文重点,其它部分甚至不用看4. 打包5.测试,测试依赖于前两篇所构建的测试项目,当然这不重要三、总结 一、前言 昨天和项目组内一位经验丰富的老师傅探讨,围绕着SpringBoot打包后动不动就一百多兆,在现场远程维护部署时非常不方便的问题,进行了一番请教。问题的根本是:有时候仅仅改动了一点点东西,却要发给现场替换包含所有依赖的jar包,这非常的笨重不方便。 于是又学到了新知识。抽空浏览了网上的资料,结合工作中的实际使用

是小宗啊?的博客 1万+

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

springboot 配置文件不生效,maven没有打包resources

去掉 <packaging>pom</packaging> 加入 <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId>

weixin_43210754的博客 1707

maven打包spring boot项目时没有将配置文件打包进去的解决办法

正常我们用eclipse打包spring boot的项目为jar包时,配置文件的路径为BOOT-INF/classes下 我们的spring boot的项目打完jar包时,没有发现配置文件 最后在打包的pom文件中发现了问题 原来的配置信息如下; src/main/java **/*.xml 修改后的配置文件信息如下; src/main/j...

qq_38220334的博客 3686

使用maven 打包springboot项目失败的解决办法

###撒旦撒旦

winwinwin99的博客 1209

springboot:maven打包出错(3.2.0:resources)

文章目录1 maven打包出错1.1 错误信息1.2 解决方式1.2.1 问题原因1.2.2 解决方式 1 maven打包出错 1.1 错误信息 -------------------------------------------------- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project baseli

hzp 5074

springboot使用maven命令打包jar及配置文件配置

sspringboot项目如果不想每次修改配置文件就要重新打包jar的话,可以进行以下配置进行打包 1.在resources下新建assembly文件夹package.xml <?xml version="1.0" encoding="UTF-8"?> <assembly xmlns="http://maven.apache.org/plugi...

weixin_30512785的博客 1696

springboot使用maven插件打包项目

springboot使用maven插件打包项目 springboot将项目打包成jar包时,默认会将所有依赖都打包进去,这样使得打包后的jar包十分庞大。可以通过配置maven插件来打包项目,将资源文件和依赖文件以及代码文件分离开。这样在依赖文件没有变动的情况下,后续只需要更新打包后的不含依赖的项目代码jar包即可。 1. 涉及插件 maven-resources-plugin | 处理资源文件 maven-dependency-plugin | 处理依赖文件 maven-jar-plugin | 打包

@chen 2402

IDEA创建Spring,Maven项目没有resources文件夹

在Modules模块找到对应路径,在main下创建resources,右键main,选择新文件夹。找到刚才创建的文件夹,右键,选择设置为Resources。输入文件名resources,点击OK。点击Apply,OK退出。

m0_68681879的博客 1万+

SpringBoot使用Maven打包编译时修改配置文件中变量(一)

有这样一个需求:项目根目录下的多个Module中有同一个变量,修改时要挨个去改,非常容易出错,能不能把它个集中到一起定义一个统一变量呢?当然是可以的,maven-resources-plugin插件很简单地实现了这个功能,步骤如下: 一、在pom的properties下新增一个变量 my.demo.content test22222 二、在pom文件的build的plunins下新增如下pl

wangfei0904306的博客 1万+

springboot项目利用maven进行多环境打包

项目开发环境 springboot2.0 jdk1.8 如何利用maven对springboot项目进行多环境打包呢? springboot运行的时候默认是加载application.properties的,如果还是按照传统springmvc的maven多环境打包方式直接将配置命名为application-dev.properties,application-sit.properties等...

coolcoffee168的专栏 1572

Springboot 使用Maven实现多环境打包

当项目有多个运行环境需要打包发布时,每次手动修改yml配置未免太过劳累

The Home Of Salt Fish 2011
上一篇: springboot 使用logback日志, 配置按天(按月)切分日志 不生效的 2 种原因
下一篇: IDEA 导入新项目时报错: Unable to import maven project: See logs for details  的解决方案
Cedhryi
博客等级 码龄8年 4粉丝 4原创
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值