手上有個(gè)項(xiàng)目需要以jar方式運(yùn)行,使用maven-shade-plugin插件構(gòu)建成功后,在 專業(yè)成都網(wǎng)站建設(shè)公司,做排名好的好網(wǎng)站,排在同行前面,為您帶來(lái)客戶和效益!創(chuàng)新互聯(lián)建站為您提供成都網(wǎng)站建設(shè),五站合一網(wǎng)站設(shè)計(jì)制作,服務(wù)好的網(wǎng)站設(shè)計(jì)公司,成都做網(wǎng)站、成都網(wǎng)站制作、成都外貿(mào)網(wǎng)站建設(shè)負(fù)責(zé)任的成都網(wǎng)站制作公司! 在pom文件maven-shade-plugin插件的配置信息中添加: <configuration> ? ? <filters> ? ? ? ? <filter> ? ? ? ? ? ? <artifact>*:*</artifact> ? ? ? ? ? ? <excludes> ? ? ? ? ? ? ? ? <exclude>META-INF/*.SF</exclude> ? ? ? ? ? ? ? ? <exclude>META-INF/*.DSA</exclude> ? ? ? ? ? ? ? ? <exclude>META-INF/*.RSA</exclude> ? ? ? ? ? ? </excludes> ? ? ? ? </filter> ? ? </filters> ? ? <!-- Additional configuration. --> </configuration> 繼續(xù)運(yùn)行,之前的錯(cuò)誤解決了,卻提示新的錯(cuò)誤:“Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context] Offending resource: class path resource [applicationContext.xml]” 解決辦法是在構(gòu)建的時(shí)候加入META-INF/spring.schemas 和 META-INF/spring.handlers transformers,最終的maven-shade-plugin插件信息配置如下: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version> 1.7.1</version> <executions> <execution>? <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <filters> ? ? ? ? <filter> ? ? ? ? ? ? <artifact>*:*</artifact> ? ? ? ? ? ? <excludes> ? ? ? ? ? ? ? ? <exclude>META-INF/*.SF</exclude> ? ? ? ? ? ? ? ? <exclude>META-INF/*.DSA</exclude> ? ? ? ? ? ? ? ? <exclude>META-INF/*.RSA</exclude> ? ? ? ? ? ? </excludes> ? ? ? ? </filter> ? ? </filters> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/spring.handlers</resource> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/spring.schemas</resource> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>com.zhilin.paopao.server.NIOServer</mainClass> </transformer> </transformers> </configuration> </execution> </executions> </plugin> 重新clean install打包,再次運(yùn)行之后問(wèn)題解決~
當(dāng)前名稱:Maven構(gòu)建可運(yùn)行的jar包出錯(cuò)解決辦法
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、建站公司、服務(wù)器托管、營(yíng)銷型網(wǎng)站建設(shè)、全網(wǎng)營(yíng)銷推廣、自適應(yīng)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源:
創(chuàng)新互聯(lián)
鏈接分享:http://muchs.cn/article38/ihsipp.html
移動(dòng)網(wǎng)站建設(shè)知識(shí)