两行代码完成alfresco的环境初始化

Alfresco环境配置测试
本文展示了一个简单的Alfresco环境配置测试类,通过Spring框架加载Alfresco应用上下文,实现快速启动和测试的目的。

package org.teamlet.alfresco.env; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class AlfrescoEVNTest { static ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { "classpath:alfresco/application-context.xml" }); public static void main(String args[]){ System.exit(0); } }

// ================= 全局仓库配置 ================= [^1][^2] allprojects { // 配置插件仓库 pluginManagement { repositories { mavenLocal() // 本地仓库 maven { url "https://plugins.gradle.org/m2" } // Gradle官方插件仓库 maven { url "https://maven.aliyun.com/repository/public" } // 阿里云镜像 mavenCentral() // Maven中央仓库 } } // 配置项目依赖仓库 repositories { // 1. 最高优先级:本地开发缓存(避免重复下载) mavenLocal() // 2. 企业私有仓库(包含内部构件) maven { url "http://106.55.225.129:18081/repository/maven-public/" credentials { username = "admin" password = "612%YN1562dd" } } // 3. 国内镜像加速(提升公共依赖下载速度) maven { url "https://maven.aliyun.com/nexus/content/groups/public" } maven { url "http://repo.maven.apache.org/maven2" } maven { url "https://app.camunda.com/nexus/content/groups/public" } maven { url "http://repo.spring.io/release/" } maven { url "https://maven.alfresco.com/nexus/content/groups/public" } // 4. 默认中央仓库(兜底) mavenCentral() } } // ================= 全局属性配置 ================= [^1] ext { javaVersion = JavaVersion.VERSION_17 // 全局Java版本 encoding = "UTF-8" // 统一字符编码 } // ================= 任务全局配置 ================= gradle.projectsLoaded { rootProject.allprojects { tasks.withType(JavaCompile).configureEach { options.encoding = rootProject.ext.encoding // 统一编译编码 sourceCompatibility = rootProject.ext.javaVersion targetCompatibility = rootProject.ext.javaVersion } // 测试任务配置 tasks.withType(Test) { useJUnitPlatform() testLogging { events "passed", "skipped", "failed" } } } } // ================= 构建生命周期监听 ================= [^3] gradle.buildFinished { BuildResult result ->{ if (result.failure) { println "构建失败原因: ${result.failure.message}" } else { println "构建成功!" } // 构建完成时发送通知 def buildResult = result.failure ? "失败 ❌" : "成功 ✅" def startTime = gradle.startTime def durationMillis = System.currentTimeMillis() - startTime def mins = TimeUnit.MILLISECONDS.toMinutes(durationMillis) def secs = TimeUnit.MILLISECONDS.toSeconds(durationMillis) - TimeUnit.MINUTES.toSeconds(mins) def duration = "${mins} min ${secs} sec" println "\n================================================" println "| 构建结果: $buildResult" println "| 总耗时: $duration" println "| 私有仓库: http://106.55.225.129:18081" println "================================================\n" } }
最新发布
11-05
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值