Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

基座 jar 包无法读取 conf/ark/bootstrap.properties 自定义配置 #1021

Open
gaosaroma opened this issue Nov 1, 2024 · 2 comments
Open
Labels

Comments

@gaosaroma
Copy link
Collaborator

gaosaroma commented Nov 1, 2024

Feature description

现状

在 SOFA-ARK 2.0+ 中,基座启动 ArkContainer 时,将通过 ContainerClassLoader 读取自定义配置。但 ContainerClassLoader 的 ucp 仅有基座 resources/conf/ark 目录、 sofa-ark-all 及其依赖,从而无法读取用户自定义配置,见:

  • Ark 配置读取
    com.alipay.sofa.ark.container.ArkContainer#getProfileConfFiles
    image

  • ContainerClassLoader 初始化
    com.alipay.sofa.ark.bootstrap.AbstractLauncher#createContainerClassLoader(com.alipay.sofa.ark.spi.archive.ContainerArchive)
    image

需求

支持读取用户基座中 conf/ark/bootstrap.properties 作为自定义配置。

Additional notes

Add other notes if necessary.

@gaosaroma
Copy link
Collaborator Author

gaosaroma commented Nov 4, 2024

解决方式:

  • 方式一【推荐】

把 conf/ark/bootstrap.properties 放在资源文件夹中

  • 方式二

在基座打包时,可以通过 maven-resources-plugin 把 conf 资源打包到 jar 包中,如:

<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-resources</id>
						<!-- here the phase you need -->
						<phase>prepare-package</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${basedir}/target/classes/conf/ark</outputDirectory>
							<resources>
								<resource>
									<directory>${basedir}/conf/ark</directory>
									<filtering>true</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>

@gaosaroma gaosaroma changed the title ArkContainer 支持读取自定义配置 基座 jar 包无法读取 conf/ark/bootstrap.properties 自定义配置 Nov 19, 2024
Copy link

This issue has been automatically marked as stale because it has not had recent activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue or help wanted) or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant