Skip to main content

下载并解压 Spring 框架代码

Project description

spring-initializer

能做什么

从 Spring 官网下载并解压以生成 spring boot 框架代码。

存在的意义

一般通过 Idea 从 https://start.spring.io/ 下载框架代码,但很诡异的是,经常会出现浏览器可以访问,但 Idea 无法下载的问题,尝试通过 curl 等 Linux 命令行 web 客户端下载,依然有概率出现连接超时的问题。

网上给出的解决方案是将 Spring 官网源替换为阿里源,我本来也打算这么干,但发现阿里源使用的是过时版本,版本支持上与官网不一致,因此就有了这个工具。

本工具的旨在通过其它方式无法快速下载 Spring 框架代码时,可以通过这个工具从官网下载,工具内设置了超时重试机制,默认是尝试10次,每次 2s 超时后重新尝试。

下载完后会自动解压,解压完成后会删除原始压缩包。

使用这个工具的另一个好处是可以扩展框架代码部署行为,比如最近几个版本的 Spring 中默认的 Lombok 存在 bug,需要将其指定为最新版,每次创建项目都要来这么一下,否则运行就会报错,完全可以在这个工具中自定义 pom 修改逻辑,让修改 pom 自动化完成。当然,目前没有这个功能,等以后更新或者你自行 fork。

安装

本工具用 Python 编写,通过 pip 安装:

pip install spring-initializer

使用

可以通过以下命令下载和生成框架代码:

pysi

不使用任何参数执行命令,会在工作目录下生成一个spring_demo目录,框架代码部署在其中。默认生成的是 Maven 项目,包含(spring-web 和 lombok)这两个常用依赖,使用的 Java 语言级别是 21。

可以通过命令行参数修改默认行为,比如指定目录名或生成 Gradle 项目等,参数说明可以通过以下命令查看:

pysi -h

问题反馈

可以给我发邮件:icexmoon@qq.com

或者通过 github:Issues · icexmoon/spring-initializer

更新记录

1.0.0

创建。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spring_initializer-1.0.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spring_initializer-1.0.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file spring_initializer-1.0.1.tar.gz.

File metadata

  • Download URL: spring_initializer-1.0.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.5

File hashes

Hashes for spring_initializer-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ecfb8ee90c36f8e2e3c4ffd4cf0f1084bd1f7cb07630afe0c60915c692aa5b1e
MD5 b3a0613815260836758c67c0493e5829
BLAKE2b-256 b74bee4e7a38a559cb1903689e68c603aacf71107dd2ed65465dc279993bd92f

See more details on using hashes here.

File details

Details for the file spring_initializer-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for spring_initializer-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9d1c66d4e526c53f066473d86710f065508944240db1a8e36b422427ad2cf42a
MD5 9ba477642d86e1a1d6417186c8f51b58
BLAKE2b-256 85c2ff98cc6df80f5bf39789d7bf480fd8514b66530e063064d70593a1c3d568

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page