• 本地搭建start.spring.io


     内网或者网络不好的时候就无法使用start.spring.io 新建springboot项目了,所有就自己搭建本地的服务器吧。

    • 使用git cloen代码:git clone https://github.com/spring-io/start.spring.io.git

    • 打包编译:cd start.spring.io ,执行./mvnw clean package -Dmaven.test.skip=true

    • 进入start-site arget目录下两个jar包 用start-site-exec.jar可以, 使用java -jar -Dserver.port=8080 start-site-exec.jar 运行

    • IDEA之中,使用Custom,填入localhost:8080然后创建项目

      

      

    遇到的问题及解决办法:


     

     ERROR1:

    [ERROR] Failed to execute goal io.spring.javaformat:spring-javaformat-maven-plugin:0.0.26:validate (default) on project start-site: Formatting violations found in the following files:

    [INFO] start.spring.io .................................... SUCCESS [  4.016 s]
    [INFO] start.spring.io client ............................. SUCCESS [02:43 min]
    [INFO] start.spring.io website ............................ FAILURE [ 12.280 s]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  03:01 min
    [INFO] Finished at: 2021-04-23T16:39:46+08:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal io.spring.javaformat:spring-javaformat-maven-plugin:0.0.26:validate (default) on project start-site: Formatting violations found in the following files:
    [ERROR]  * D:start.spring.iostart-sitesrcmainjavaiospringstartsiteextensionuildgradleGradleBuildSystemHelpDocumentCustomizer.java
    [ERROR]  * D:start.spring.iostart-sitesrcmainjavaiospringstartsiteextensionuildgradleGradleProjectGenerationConfiguration.java
    ......
    ......
    [ERROR]  * D:start.spring.iostart-sitesrc	estjavaiospringstartsitesupportimplicitImplicitDependencyTests.java
    [ERROR]  * D:start.spring.iostart-sitesrc	estjavaiospringstartsitesupportStartInitializrMetadataUpdateStrategyTests.java
    [ERROR]
    [ERROR] Run `spring-javaformat:apply` to fix.
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    [ERROR]
    [ERROR] After correcting the problems, you can resume the build with the command
    [ERROR]   mvn <args> -rf :start-site

    解决办法:

      很明显了,仔细看一下错误信息就能解决!! 其实最后给了解决办法了 Run `spring-javaformat:apply` to fix. 

    因为这个工程使用的是mvnw ,所以运行一下命令解决此问题。

    $  ./mvnw spring-javaformat:apply


     ERROR2:

       maven git插件找不到.git目录的问题!!

    [ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:3.0.1:revision (default) on project start-site: .git directory is not found! Please specify a valid [dotGitDirectory] in your pom.xml -> [Help 1]

    错误详细:

    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary for start.spring.io 0.0.1-SNAPSHOT:
    [INFO]
    [INFO] start.spring.io .................................... SUCCESS [  3.527 s]
    [INFO] start.spring.io client ............................. SUCCESS [ 53.677 s]
    [INFO] start.spring.io website ............................ FAILURE [ 27.601 s]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  01:26 min
    [INFO] Finished at: 2021-04-23T17:03:42+08:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:3.0.1:revision (default) on project start-site: .git directory is not found! Please specify a valid [dotGitDirectory] in your pom.xml -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
    [ERROR]
    [ERROR] After correcting the problems, you can resume the build with the command
    [ERROR]   mvn <args> -rf :start-site

    解决办法:

           不知道在github上下载的官方源码为啥会有问题!!既然错误信息里说了“未找到git目录!”  ,那解决办法有两种:1,给他配置目录  2,跳过执行该目标;    建议新手小白使用第二种,,,我就是使用第二种,,,言归正传,第二种解决办法如下:

    找到你想项目->  github源码根目录start-sitepom.xml -->编辑此文件  -->搜索git-commit-id-plugin”  -->新增以下北京黄色部分代码

    <plugin>
        <groupId>pl.project13.maven</groupId>
        <artifactId>git-commit-id-plugin</artifactId>
        <configuration>
            <!--".git"文件夹未找到时,构建是否失败;若设置true,则构建失败;若设置false,则跳过执行该目标;默认值:true;-->
            <failOnNoGitDirectory>false</failOnNoGitDirectory>
        </configuration>
    </plugin>

    参考资料:

     https://blog.csdn.net/wangjunjun2008/article/details/10526151

     https://www.it1352.com/802011.html

    知识扩展:


     1.使用./mvnw **  命令下载资源太慢??

    解决办法:

           首先你的明白mvnw跟mvn命令的区别,推荐看下这篇博客:https://blog.csdn.net/Fishandbearspaw/article/details/104637284/  简单明了 适合新手!

    看完博客之后呢??我们去修改他的这个命令maven的配置文件:

    C:Users登录名.m2wrapperdistsapache-maven-你的版本号-bin1iopthnavndlasol9gbrbg6bf2apache-maven-你的版本号confsettings.xml

    例如我的:

    C:UsersAdministrator.m2wrapperdistsapache-maven-3.6.3-bin1iopthnavndlasol9gbrbg6bf2apache-maven-3.6.3confsettings.xml

     其实就是修改mirrors 指定去aliyun下载!!

    maven settings.xml完整配置文件
  • 相关阅读:
    Javascript 多浏览器兼容性问题及解决方案
    Vue-学习。
    angular-动画。
    Angular-学习。
    JQuery-学习。
    Bootstrap框架。
    Swiper-轮播图。
    jquery validation表单验证插件2。
    jquery validation表单验证插件。
    Grunt-学习。
  • 原文地址:https://www.cnblogs.com/chenghu/p/14694649.html
Copyright © 2020-2023  润新知