【问题标题】:How change zip archive download folder for embedpostgresql?如何更改 embedpostgresql 的 zip 存档下载文件夹?
【发布时间】:2017-04-03 03:14:53
【问题描述】:

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

【问题讨论】:

    标签: java postgresql maven embedpostgresql


    【解决方案1】:

    您只需使用 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,执行了“grep -R embedpostgresql *”并在 ru.yandex.qatools.embed.postgresql.config.DownloadConfigBuilder 类中找到了第一个提示。然后我自己测试了,效果很好!

    【讨论】:

      猜你喜欢
      • 2013-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-26
      • 1970-01-01
      • 2020-07-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多