当前位置: 首页 > news >正文

maven archetype

1.简介

maven脚手架是为了创建一个项目模板,以后新建项目都能够复用该模板
maven中模板引擎使用的是velocity,在文件中可以使用它的语法获取变量等操作

2.实现

单模块脚手架实现
image.png

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.example</groupId><artifactId>single-springboot-template</artifactId><version>1.0-SNAPSHOT</version><packaging>maven-archetype</packaging><properties><maven.compiler.source>11</maven.compiler.source><maven.compiler.target>11</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version><maven-source-plugin.version>3.2.1</maven-source-plugin.version><maven-gpg-plugin.version>1.6</maven-gpg-plugin.version><maven-archetype-plugin.version>3.2.1</maven-archetype-plugin.version><maven-checksum-plugin.version>1.10</maven-checksum-plugin.version></properties><build><extensions><extension><groupId>org.apache.maven.archetype</groupId><artifactId>archetype-packaging</artifactId><version>${maven-archetype-plugin.version}</version></extension></extensions><plugins><plugin><groupId>net.nicoulaj.maven.plugins</groupId><artifactId>checksum-maven-plugin</artifactId><version>${maven-checksum-plugin.version}</version><executions><execution><id>create-checksums</id><goals><goal>artifacts</goal></goals></execution></executions></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-source-plugin</artifactId><version>2.2.1</version><executions><execution><id>attach-sources</id><goals><goal>jar-no-fork</goal></goals></execution></executions></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-javadoc-plugin</artifactId><version>2.9.1</version><configuration><encoding>UTF-8</encoding><aggregate>true</aggregate><charset>UTF-8</charset><docencoding>UTF-8</docencoding></configuration><executions><execution><id>attach-javadocs</id><goals><goal>jar</goal></goals><configuration><additionalparam>-Xdoclint:none</additionalparam></configuration></execution></executions></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-release-plugin</artifactId><version>2.5.3</version><configuration><autoVersionSubmodules>true</autoVersionSubmodules><useReleaseProfile>false</useReleaseProfile><releaseProfiles>release</releaseProfiles><goals>deploy</goals></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><version>3.1.0</version><configuration><includeEmptyDirs>true</includeEmptyDirs><addDefaultExcludes>false</addDefaultExcludes></configuration></plugin><plugin><artifactId>maven-archetype-plugin</artifactId><version>${maven-archetype-plugin.version}</version><configuration><!-- needed to include .gitignore --><useDefaultExcludes>false</useDefaultExcludes></configuration></plugin></plugins></build>
</project>

archetype-metadata.xml

<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptorxsi:schemaLocation="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0 http://maven.apache.org/xsd/archetype-descriptor-1.1.0.xsd"name="xfg-frame-archetype"xmlns="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><fileSets><fileSet filtered="true" encoding="UTF-8"><directory>docs</directory><includes><include>**/**</include></includes></fileSet><fileSet filtered="true" encoding="UTF-8"><directory>script</directory><includes><include>**/**</include></includes></fileSet><fileSet filtered="true" encoding="UTF-8"><directory>deploy</directory><includes><include>**/**</include></includes></fileSet><fileSet encoding="UTF-8"><directory/><includes><include>README.md</include><include>.gitignore</include></includes></fileSet><fileSet filtered="true" encoding="UTF-8"><directory>src/main/java</directory><includes><include>**/**</include></includes></fileSet><fileSet filtered="true" encoding="UTF-8"><directory>src/main/resources</directory><includes><include>**/**</include></includes></fileSet><fileSet><directory>src/test/java</directory></fileSet></fileSets>
</archetype-descriptor>
#模板项目安装到本地
mvn claen install#执行生成项目命令 静默方式不需要用户输入mvn archetype:generate -DgroupId=com.wl -DartifactId=demo -Dpackagename=com.wl -DarchetypeGroupId=org.example -DarchetypeArtifactId=single-springboot-template -DarchetypeVersion=1.0-SNAPSHOT  -DinteractiveMode=false#执行生成项目命令mvn archetype:generate -DgroupId=com.wl -DartifactId=demo -Dpackagename=com.wl  -DarchetypeGroupId=org.example -DarchetypeArtifactId=single-springboot-template -DarchetypeVersion=1.0-SNAPSHOT

3.参考文档

  1. https://medium.com/@sybrenbolandit/maven-archetype-deed0160cdeb
  2. Velocity入门到精通(上篇)_velocity教程-CSDN博客

相关文章:

maven archetype

1.简介 maven脚手架是为了创建一个项目模板&#xff0c;以后新建项目都能够复用该模板 maven中模板引擎使用的是velocity,在文件中可以使用它的语法获取变量等操作 2.实现 单模块脚手架实现 pom.xml <?xml version"1.0" encoding"UTF-8"?> &…...

浏览器打开抽奖系统html

<!DOCTYPE html> <html> <head> <meta charset"utf-8"> <title>在线抽奖 随机选取 自动挑选</title> <script src"https://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <style> body {…...

微信小程序-使用Component方法代替Page方法构造页面

一.使用Component方法的前提条件 在小程序js文件里使用Component方法代替Page方法需要在json文件里面定义usingComponents属性 {"usingComponents": {} }二.注意事项 1.在page页面里使用的钩子函数和事件监听方法都需要写在methods对象里面 methods:{update(){thi…...

Spark SQL----DISTRIBUTE BY子句

Spark SQL----DISTRIBUTE BY子句 一、描述二、语法三、参数四、例子 一、描述 DISTRIBUTE BY子句用于根据输入表达式对数据进行重新分区。与CLUSTER BY子句不同&#xff0c;这不会对每个分区内的数据进行排序。 二、语法 DISTRIBUTE BY { expression [ , ... ] }三、参数 e…...

HTML5-canvas1

1、canvas&#xff1a;创建画布 <canvas id"canvas"></canvas>2、画一条直线 var canvasdocument.getElementById(cancas&#xff09;; canvas.width800; canvas.height800; var contextcanvas.getContext(2d); //获得2d绘图上下文环境 //画一条直线 c…...

【NOI-题解】1009 - 数组逆序1162 - 数组元素的删除1211 - 数组元素的插入1161. 元素插入有序数组1159. 数组元素的移动

文章目录 一、前言二、问题问题&#xff1a;1009 - 数组逆序问题&#xff1a;1162 - 数组元素的删除问题&#xff1a;1211 - 数组元素的插入问题&#xff1a;1161. 元素插入有序数组问题&#xff1a;1159. 数组元素的移动 三、感谢 一、前言 本章节主要对数组问题中数组元素移…...

新电脑如何设置 npm 源及查看源、安装 cnpm、pnpm 和 yarn 的详细教程

当你获得一台新电脑&#xff0c;或需要在现有电脑上优化 JavaScript 和 Node.js 的开发环境时&#xff0c;正确配置 npm 是一步不可少的过程。本教程将详细指导你如何设置 npm 源&#xff0c;查看当前源&#xff0c;以及如何安装 cnpm、pnpm 和 yarn。 1. 设置 npm 源 npm (N…...

完全移动huggingface模型仓库(不是简单mv)

Linux中移动huggingface模型仓库 参考链接 先在bashrc中配置&#xff1a; export HF_DATASETS_CACHE"/your/path/dataset" export HF_HOME"/your/path/" export HUGGINGFACE_HUB_CACHE"/your/path/hub" export TRANSFORMERS_CACHE"/your…...

手机空号过滤批量查询的意义及方法

手机空号过滤批量查询是现代营销和通信管理中常用的技术手段&#xff0c;旨在通过批量处理手机号码&#xff0c;筛选出活跃号码和空号等无效号码&#xff0c;以提高营销效率和减少不必要的通信成本。以下是关于手机空号过滤批量查询的详细解答&#xff1a; 一、手机空号过滤批…...

Dockerfile制作部署wordpress-6.6

目录 一. 环境准备 二. 准备对应的配置文件 三. 编写Dockerfile 四. 构建镜像 五. 配置MySQL 六. 安装wordpress 七. 扩展 一. 环境准备 localhost192.168.226.25 rocky_linux9.4 Docker version 27.0.3 关闭防火墙和selinux&#xff0c;进行时间同步。 安装docker…...

项目的纪要

ai客服项目中发现的问题: 可以在控制台看到我们存储的cookie: 可以看到是这样的, 但是我们通过getCookie方法专门获取这个字段, 然后在控制台打印后 const userName getCookie(SA_USER_NICK_NAME); console.log(userName, userName); 输出结果是: 然后我们尝试通过de…...

ubuntu 更新源

前言 实现一键替换在线源 一键更新源 ubuntu 全球镜像站以下支持现有ubuntu 20&#xff0c;22&#xff0c;24 echo "Delete the default source" rm -rf /etc/apt/sources.listecho "Build a new source" cat <<EOF>>/etc/apt/sources.li…...

XGBoost、RF随机森林算法MATLAB实现

% 加载并预处理训练数据 opts1 = detectImportOptions(附件一AE.xlsx, PreserveVariableNames, true); train_data = readtable(附件一AE.xlsx, opts1); train_data.Time = datetime(train_data.time, InputFormat, yyyy-MM-dd HH:mm:ss); % 特征提取和标签准备 windowSize…...

WPF 解决: DataGrid 已定义列,但是还是会显示模型的所有属性的问题

AutoGenerateColumns 属性 AutoGenerateColumns&#xff1a;这个属性决定 DataGrid 是否根据数据源中的属性自动生成列。如果设置为 true&#xff0c;DataGrid 会根据数据源中的属性自动生成列。如果设置为 false&#xff0c;则 DataGrid 不会自动生成列&#xff0c;开发者需要…...

【ai】Easy-RAG : ImportError: cannot import name ‘BaseModel‘ from ‘pydantic‘

[Bug]: cannot import name ‘RootModel’ from ‘pydantic’ #1237 版本不匹配导致 ImportError: cannot import name ‘BaseModel’ from ‘pydantic’ /home/zhangbin/miniconda3/envs/Easy-RAG/bin/python /home/zhangbin/proj/06_rag/02_Easy-RAG/webui.py /home/zhangbi…...

WebKit简介

WebKit是一个开源的浏览器引擎&#xff0c;最初由苹果公司开发&#xff0c;用于Safari浏览器。它是基于KDE项目的KHTML引擎进行开发&#xff0c;并在改进和扩展中形成了WebKit引擎。 WebKit的工作流程可以分为以下几个步骤&#xff1a; 1.解析HTML&#xff1a;当浏览器加载一个…...

笔记 | Python环境下的GUI编程常用包

前言 Python的使用频率和范围越来越大&#xff0c;在一些开发工作中由于需要可视化的图形界面&#xff0c;常常需要进行图形用户界面&#xff08;Graphic User Interface, GUI&#xff09;开发。例如&#xff0c;目前最火热的大模型应用&#xff0c;常常是以一个网页界面进行操…...

mysql 数据库空间统计sql

mysql 数据库空间统计 文章目录 mysql 数据库空间统计说明一、数据库存储代码二、查询某个数据库的所有表的 代码总结 说明 INFORMATION_SCHEMA Table Reference 表参考 information_schema是‌MySQL中的一个特殊数据库&#xff0c;它存储了关于所有其他数据库的元数据信息。…...

【Linux】线程——线程池、线程池的实现、线程安全的线程池、单例模式的概念、饿汉和懒汉模式、互斥锁、条件变量、信号量、自旋锁、读写锁

文章目录 Linux线程7. 线程池7.1 线程池介绍7.2 线程池的实现7.3 线程安全的线程池7.3.1 单例模式的概念7.3.2 饿汉和懒汉模式 8. 常见锁使用汇总8.1 互斥锁&#xff08;Mutex&#xff09;8.2 条件变量&#xff08;Condition Variable&#xff09;8.3 信号量&#xff08;Semaph…...

stm32入门-----TIM定时器(PWM输出比较——下)

目录 前言 一、硬件元器件介绍 1.舵机 2.直流电机驱动 二、C语言编程步骤 1.开启时钟 2.配置输出的GPIO口 3.配置时基单元 4.初始化输出比较通道 5.开启定时器 三、实践项目 1.PWM驱动LED呼吸灯 2.PWM驱动舵机 3.PWM驱动直流电机 前言 本期我们就开始去进行TIM定时…...

盘古信息PCB行业解决方案:以全域场景重构,激活智造新未来

一、破局&#xff1a;PCB行业的时代之问 在数字经济蓬勃发展的浪潮中&#xff0c;PCB&#xff08;印制电路板&#xff09;作为 “电子产品之母”&#xff0c;其重要性愈发凸显。随着 5G、人工智能等新兴技术的加速渗透&#xff0c;PCB行业面临着前所未有的挑战与机遇。产品迭代…...

MMaDA: Multimodal Large Diffusion Language Models

CODE &#xff1a; https://github.com/Gen-Verse/MMaDA Abstract 我们介绍了一种新型的多模态扩散基础模型MMaDA&#xff0c;它被设计用于在文本推理、多模态理解和文本到图像生成等不同领域实现卓越的性能。该方法的特点是三个关键创新:(i) MMaDA采用统一的扩散架构&#xf…...

2025 后端自学UNIAPP【项目实战:旅游项目】6、我的收藏页面

代码框架视图 1、先添加一个获取收藏景点的列表请求 【在文件my_api.js文件中添加】 // 引入公共的请求封装 import http from ./my_http.js// 登录接口&#xff08;适配服务端返回 Token&#xff09; export const login async (code, avatar) > {const res await http…...

OpenPrompt 和直接对提示词的嵌入向量进行训练有什么区别

OpenPrompt 和直接对提示词的嵌入向量进行训练有什么区别 直接训练提示词嵌入向量的核心区别 您提到的代码: prompt_embedding = initial_embedding.clone().requires_grad_(True) optimizer = torch.optim.Adam([prompt_embedding...

多种风格导航菜单 HTML 实现(附源码)

下面我将为您展示 6 种不同风格的导航菜单实现&#xff0c;每种都包含完整 HTML、CSS 和 JavaScript 代码。 1. 简约水平导航栏 <!DOCTYPE html> <html lang"zh-CN"> <head><meta charset"UTF-8"><meta name"viewport&qu…...

Fabric V2.5 通用溯源系统——增加图片上传与下载功能

fabric-trace项目在发布一年后,部署量已突破1000次,为支持更多场景,现新增支持图片信息上链,本文对图片上传、下载功能代码进行梳理,包含智能合约、后端、前端部分。 一、智能合约修改 为了增加图片信息上链溯源,需要对底层数据结构进行修改,在此对智能合约中的农产品数…...

mac 安装homebrew (nvm 及git)

mac 安装nvm 及git 万恶之源 mac 安装这些东西离不开Xcode。及homebrew 一、先说安装git步骤 通用&#xff1a; 方法一&#xff1a;使用 Homebrew 安装 Git&#xff08;推荐&#xff09; 步骤如下&#xff1a;打开终端&#xff08;Terminal.app&#xff09; 1.安装 Homebrew…...

通过 Ansible 在 Windows 2022 上安装 IIS Web 服务器

拓扑结构 这是一个用于通过 Ansible 部署 IIS Web 服务器的实验室拓扑。 前提条件&#xff1a; 在被管理的节点上安装WinRm 准备一张自签名的证书 开放防火墙入站tcp 5985 5986端口 准备自签名证书 PS C:\Users\azureuser> $cert New-SelfSignedCertificate -DnsName &…...

MFE(微前端) Module Federation:Webpack.config.js文件中每个属性的含义解释

以Module Federation 插件详为例&#xff0c;Webpack.config.js它可能的配置和含义如下&#xff1a; 前言 Module Federation 的Webpack.config.js核心配置包括&#xff1a; name filename&#xff08;定义应用标识&#xff09; remotes&#xff08;引用远程模块&#xff0…...

Sklearn 机器学习 缺失值处理 获取填充失值的统计值

💖亲爱的技术爱好者们,热烈欢迎来到 Kant2048 的博客!我是 Thomas Kant,很开心能在CSDN上与你们相遇~💖 本博客的精华专栏: 【自动化测试】 【测试经验】 【人工智能】 【Python】 使用 Scikit-learn 处理缺失值并提取填充统计信息的完整指南 在机器学习项目中,数据清…...