如何更改embedpostgresql的zip存档下载文件夹?

时间:2017-03-31 02:51:08

标签: java postgresql maven embedpostgresql

Here是embedpostgresql库,用于通过java启动postgres进程。关于从zip存档中重新使用已经提取的postgres的instruction。但是如何更改存档目录?默认情况下,他们将maven存储到a < b我想将其更改为maven存储库但是需要调用什么来设置这样的属性?

1 个答案:

答案 0 :(得分:0)

您只需使用 DownloadConfigBuilder 类中的 artifactStorePath()方法:

final FixedPath cachedDir = new FixedPath("/tmp/cacheddir");
final FixedPath artifactStoreDir = new FixedPath("/tmp/artstoredir");
 IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder().defaults(cmd)
 .artifactStore(new CachedArtifactStoreBuilder()
         .defaults(cmd)
         .tempDir(cachedDir)
         .download(new DownloadConfigBuilder()
                 .defaultsForCommand(cmd)
                 .artifactStorePath(artifactStoreDir)
                 .packageResolver(new PackagePaths(cmd, cachedDir))
                 .build()))
 .build();

//starting Postgres
 final PostgresStarter<PostgresExecutable, PostgresProcess> runtime =
 PostgresStarter.getInstance(runtimeConfig);

我克隆了git repository,做了一个&#39; grep -R embedpostgresql *&#39;并在ru.yandex.qatools.embed.postgresql.config.DownloadConfigBuilder类中找到了第一个提示。然后我自己测试了它的确有效!