本帖最后由 Freeze_Dolphin 于 2021-1-27 08:58 编辑 
taboolib-quickstart-archetype  
介绍
这是一个用于创建已经部署好的依赖taboolib的spigot/bukkit服务器插件的maven骨架
类似于TabooLib-SDK
专门给不肯搞gradle的maven钉子户用的
从archetype创建项目
(折叠框里的是图片)
- 常见的IDE如Eclipse、IntelliJ在创建maven项目时都会让你选择archetype, 你可以直接用"Add Archetype"功能添加远程archetype到内部Nexus服务器; 也可以先添加archetype repository再从其中选取适当的archetype. 这里提供后一种方法, 以Eclipse为例:
 
-         在设置(Preferences)中找到: Maven > Archetypes
- 在右侧点击 "Add Remote Catalog" 并按照图中的方式进行配置
 
你也可以从控制台创建一个基于此archetype的maven项目
- 打开console或者terminal, 切到你想要创建工程的目录下
- 输入以下指令:复制代码- mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=io.freeze-dolphin.archetypes -DarchetypeArtifactId=taboolib-quickstart-archetype -DarchetypeVersion=1.1.0 -DarchetypeRepository=https://raw.github.com/freeze-dolphin/maven-repository/master/repository
 
 
- 之后会让你配置项目的properties(properties中的"groupId"和""artifactId"以及"author"是必填项, 这些都可以在生成的pom.xml中修改)
- 从ide导入生成的maven项目并开始开发
 
注意事项
- 默认去掉了test包, 如果有需要可以自己加回来
- 通过指令生成项目时请注意一定要用2.4版本的maven-archetype-plugin, 因为貌似只有2.x版本才能在命令行中指定archetypeRepository (当时费了我好久才发现这个= .=)
 
开源相关
开源地址
github上自建的maven repository: https://github.com/freeze-dolphin/maven-repository
taboolib-quickstart-archetype源码: https://github.com/freeze-dolphin/taboolib-quickstart-archetype
欢迎发issue
如果这个骨架有帮到你的话请在github给个Star或者 评个分 叭
不愧是大佬,深奥,看来我还要学习更多
wows可还行 不愧是你
        MCBBS有你更精彩~
 本帖最后由 DarcJC 于 2021-5-25 23:31 编辑 
注意,对于Maven 3.x,IDEA添加ArcheType时的Repository是无效的。
相关issue:https://youtrack.jetbrains.com/issue/IDEA-223617
编辑2:Windows的PowerShell中,部分命令内容需使用引号。
复制代码
如果使用镜像,需要修改mirrorOf属性:
复制代码添加,!archetype。
然后对于高版本Maven,可以在项目的pom.xml下自定义archetype remote catalog。无需自定义profile。
复制代码
原文:
如果非得要这样初始化的话,
可以在对应setting.xml中,添加:
复制代码
以及
复制代码
编辑1,2021年5月25日:
噢对,IDEA不能直接创建,好像是因为不支持交互模式。正在使用高版本Maven的话,建议使用IDEA创建项目后在项目目录使用命令创建。
注意,对于Maven 3.x,IDEA添加ArcheType时的Repository是无效的。
相关issue:https://youtrack.jetbrains.com/issue/IDEA-223617
编辑2:Windows的PowerShell中,部分命令内容需使用引号。
- mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId="io.freeze-dolphin.archetypes" -DarchetypeArtifactId=taboolib-quickstart-archetype -DarchetypeVersion="1.1.0" -DarchetypeRepository=https://raw.github.com/freeze-dolphin/maven-repository/master/repository
如果使用镜像,需要修改mirrorOf属性:
- <mirror>
 
-             <id>aliyunmaven</id>
 
-             <mirrorOf>central,!archetype</mirrorOf>
 
-             <name>阿里云公共仓库</name>
 
-             <url>https://maven.aliyun.com/repository/public</url>
 
- </mirror>
然后对于高版本Maven,可以在项目的pom.xml下自定义archetype remote catalog。无需自定义profile。
- <repositories>
 
-         <repository>
 
-             <id>archetype</id><!-- id expected by maven-archetype-plugin to avoid fetching from everywhere -->
 
-             <url>https://raw.github.com/freeze-dolphin/maven-repository/master/repository</url>
 
-             <releases>
 
-                 <enabled>true</enabled>
 
-                 <checksumPolicy>fail</checksumPolicy>
 
-             </releases>
 
-             <snapshots>
 
-                 <enabled>true</enabled>
 
-                 <checksumPolicy>warn</checksumPolicy>
 
-             </snapshots>
 
-         </repository>
 
- </repositories>
原文:
如果非得要这样初始化的话,
可以在对应setting.xml中,添加:
- <profile>
 
-             <id>freeze-dolphin</id>
 
-             <repositories>
 
-                 <repository>
 
-                     <id>archetype</id><!-- id expected by maven-archetype-plugin to avoid fetching from everywhere -->
 
-                     <url>https://raw.github.com/freeze-dolphin/maven-repository/master/repository</url>
 
-                     <releases>
 
-                         <enabled>true</enabled>
 
-                         <checksumPolicy>fail</checksumPolicy>
 
-                     </releases>
 
-                     <snapshots>
 
-                         <enabled>true</enabled>
 
-                         <checksumPolicy>warn</checksumPolicy>
 
-                     </snapshots>
 
-                 </repository>
 
-             </repositories>
 
- </profile>
以及
- <activeProfile>freeze-dolphin</activeProfile>
编辑1,2021年5月25日:
噢对,IDEA不能直接创建,好像是因为不支持交互模式。正在使用高版本Maven的话,建议使用IDEA创建项目后在项目目录使用命令创建。
DarcJC 发表于 2021-5-25 22:36
注意,对于Maven 3.x,IDEA添加ArcheType时的Repository是无效的。
相关issue:https://youtrack.jetbrains ...
感谢补充鸭
(没想到这帖子过了这么久还有人看)