in core/src/main/java/org/apache/rocketmq/schema/registry/core/dependency/DynamicCompileProvider.java [98:137]
public static void upload(
final String localRepo,
final DependencyHelper dependencyHelper,
final String userName,
final String passWord,
final String repoUrl
) {
String groupId = dependencyHelper.getDependency().getGroupId();
String artifactId = dependencyHelper.getDependency().getArtifactId();
String version = dependencyHelper.getDependency().getVersion();
File jarFile = new File(dependencyHelper.getJarFilePath());
File pomFile = new File(dependencyHelper.getPomFilePath());
Artifact jarArtifact = new DefaultArtifact(groupId, artifactId, null, "jar", version, null, jarFile);
Artifact pomArtifact = new SubArtifact(jarArtifact, null, "pom", pomFile);
Authentication auth = new AuthenticationBuilder()
.addUsername(userName)
.addPassword(passWord)
.build();
RemoteRepository remoteRepo = new RemoteRepository
.Builder("central", "default", repoUrl)
.setAuthentication(auth)
.build();
try {
String versionCache = CommonUtil.mkdir(String.format("%s/version_cache/%d_resources",
localRepo, System.currentTimeMillis())).getCanonicalPath();
RepositorySystemSession session = newSession(SYSTEM, versionCache);
DeployRequest deployRequest = new DeployRequest()
.setRepository(remoteRepo)
.addArtifact(jarArtifact)
.addArtifact(pomArtifact);
DeployResult result = SYSTEM.deploy(session, deployRequest);
log.info("transfer artifact " + groupId + ":" + artifactId + ":" + version + " to central success.");
} catch (DeploymentException | IOException e) {
throw new SchemaException("Deploy jar file: " + jarFile + " failed", e);
}
}