Browse Source

初始化工程

main
庄锐波 4 months ago
parent
commit
ba9a6c14a5
  1. 45
      Libs/install-to-maven.ps1
  2. 41
      Libs/zdxt-common-5.6.0.pom

45
Libs/install-to-maven.ps1

@ -1,11 +1,49 @@
# 将 Libs 目录下的所有 *.jar 安装到本地 Maven 仓库 # 将 Libs 目录下的所有 *.jar 安装到本地 Maven 仓库
# groupId: org.dromara, version: 5.6.0 # groupId: org.dromara, version: 5.6.0
# 安装顺序:根POM → 纯POM父模块 → JAR(确保 parent 链完整)
# 若同目录存在同名 .pom 文件,则使用真实 POM(传递依赖完整);否则自动生成空 POM。 # 若同目录存在同名 .pom 文件,则使用真实 POM(传递依赖完整);否则自动生成空 POM。
$libsDir = $PSScriptRoot $libsDir = $PSScriptRoot
$groupId = "org.dromara" $groupId = "org.dromara"
$version = "5.6.0" $version = "5.6.0"
# ====== 第一步:安装根 POM(提供 dependencyManagement) ======
Write-Host "`n=== Step 1: Installing root POM (EnforcementCode) ===" -ForegroundColor Magenta
$rootPomPath = (Resolve-Path (Join-Path $libsDir "..\pom.xml")).Path
if (Test-Path $rootPomPath) {
mvn install:install-file `
"-Dfile=$rootPomPath" `
"-DgroupId=$groupId" `
"-DartifactId=EnforcementCode" `
"-Dversion=$version" `
"-Dpackaging=pom"
if ($LASTEXITCODE -eq 0) { Write-Host " -> OK" -ForegroundColor Green }
else { Write-Host " -> FAILED" -ForegroundColor Red }
} else {
Write-Host " -> Root pom.xml not found at $rootPomPath, skipping" -ForegroundColor Yellow
}
# ====== 第二步:安装纯 POM 父模块(只有 .pom 没有对应 .jar 的文件) ======
Write-Host "`n=== Step 2: Installing parent POMs (no matching JAR) ===" -ForegroundColor Magenta
Get-ChildItem -Path $libsDir -Filter "*.pom" | Where-Object {
$jarName = $_.BaseName + ".jar"
-not (Test-Path (Join-Path $libsDir $jarName))
} | ForEach-Object {
$pomFile = $_.FullName
$artifactId = $_.BaseName -replace "-$version$", ""
Write-Host "Installing POM: $artifactId" -ForegroundColor Cyan
mvn install:install-file `
"-Dfile=$pomFile" `
"-DgroupId=$groupId" `
"-DartifactId=$artifactId" `
"-Dversion=$version" `
"-Dpackaging=pom"
if ($LASTEXITCODE -eq 0) { Write-Host " -> OK" -ForegroundColor Green }
else { Write-Host " -> FAILED" -ForegroundColor Red }
}
# ====== 第三步:安装 JAR(使用真实 POM 或生成空 POM) ======
Write-Host "`n=== Step 3: Installing JARs ===" -ForegroundColor Magenta
Get-ChildItem -Path $libsDir -Filter "*.jar" | ForEach-Object { Get-ChildItem -Path $libsDir -Filter "*.jar" | ForEach-Object {
$jarFile = $_.FullName $jarFile = $_.FullName
# 从文件名中提取 artifactId,例如 zdxt-common-core-5.6.0.jar -> zdxt-common-core # 从文件名中提取 artifactId,例如 zdxt-common-core-5.6.0.jar -> zdxt-common-core
@ -29,11 +67,8 @@ Get-ChildItem -Path $libsDir -Filter "*.jar" | ForEach-Object {
"-DgeneratePom=true" "-DgeneratePom=true"
} }
if ($LASTEXITCODE -eq 0) { if ($LASTEXITCODE -eq 0) { Write-Host " -> OK" -ForegroundColor Green }
Write-Host " -> OK" -ForegroundColor Green else { Write-Host " -> FAILED" -ForegroundColor Red }
} else {
Write-Host " -> FAILED" -ForegroundColor Red
}
} }
Write-Host "`nAll done." -ForegroundColor Yellow Write-Host "`nAll done." -ForegroundColor Yellow

41
Libs/zdxt-common-5.6.0.pom

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.dromara</groupId>
<artifactId>EnforcementCode</artifactId>
<version>5.6.0</version>
</parent>
<groupId>org.dromara</groupId>
<artifactId>zdxt-common</artifactId>
<version>5.6.0</version>
<packaging>pom</packaging>
<description>common 通用模块</description>
<modules>
<module>zdxt-common-bom</module>
<module>zdxt-common-social</module>
<module>zdxt-common-core</module>
<module>zdxt-common-doc</module>
<module>zdxt-common-excel</module>
<module>zdxt-common-idempotent</module>
<module>zdxt-common-log</module>
<module>zdxt-common-mail</module>
<module>zdxt-common-mybatis</module>
<module>zdxt-common-oss</module>
<module>zdxt-common-ratelimiter</module>
<module>zdxt-common-redis</module>
<module>zdxt-common-satoken</module>
<module>zdxt-common-security</module>
<module>zdxt-common-sms</module>
<module>zdxt-common-web</module>
<module>zdxt-common-translation</module>
<module>zdxt-common-sensitive</module>
<module>zdxt-common-json</module>
<module>zdxt-common-encrypt</module>
<module>zdxt-common-tenant</module>
<module>zdxt-common-websocket</module>
<module>zdxt-common-sse</module>
<module>zdxt-common-quartz</module>
</modules>
</project>
Loading…
Cancel
Save