spring boot打包问题,访问问题

用eclipse 打jar包 或者war 会报错(换maven-surefire-plugin: 其他版本一样报错 )  总结所有的可能性


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.3:test (default-test) on project jxBoot: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.3:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.3 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-surefire-plugin:jar:2.3 -> org.apache.maven.surefire:surefire-booter:jar:2.3: Failed to read artifact descriptor for org.apache.maven.surefire:surefire-booter:jar:2.3: Could not transfer artifact org.apache.maven.surefire:surefire-booter:pom:2.3 from/to central (https://repo.maven.apache.org/maven2): RSA premaster secret error: SunTls12RsaPremasterSecret KeyGenerator not available -> [Help 1]


网上找了很久没解决 ,最后还是无意中用命令解决了

有的说 缺少包

1

<plugin>  
        <groupId>org.apache.maven.plugins</groupId>  
        <artifactId>maven-surefire-plugin</artifactId>  
        <version>1.8.12</version>  
          
</plugin> 
2

<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>


有的说是要跳过测试,勾选eclipse 这个选项




有的说 用代码跳过测试

http://blog.csdn.net/caiwenfeng_for_23/article/details/44514947


有的说这个

http://blog.csdn.net/chen_jp/article/details/8524913



可能你的问题属于以上的,  如果没有解决请看我的问题解决办法:  直接用自己配置的maven 用cmd命令打包 放弃使用eclipse工具,可能是eclipse 的内部问题吧,具体我也不清楚为什么,使用命令打包成功,(成功之后,奇怪的是回过头来 再用eclipse打包结果也成功了    晕!!)




打包成功部署访问

启动项目 java -jar *****.jar  (注意路径)

启动项目 java -jar *****.war  (注意路径)( 这种方式可以解决,jar 无法访问jsp页面的问题jsp支持要加 其五的代码段 )


在项目的target文件夹下找到自己的 jar (或者war ,一般spring boot 打的是jar包) 

这里我的包名叫 jxboot.jar 访问时和直接在eclipse 上运行的访问是不一样的

http://localhost:8888/home (eclipse 上 home 方法 )
http://localhost:8888/jxboot/home (jxboot.jar 部署后访问 home方法)


这些小细节真的有时候能搞很久,时间宝贵但愿能给正在苦苦寻找方法的小伙伴节约点时间





猜你喜欢

转载自blog.csdn.net/u014596302/article/details/77428463