Here is embedpostgresql library for starting a postgres process via java. The instruction about reusing already extracted postgres from zip archive. But how to change archive directory? By default they store maven to %USER_HOME\\.embedpostgresql%
I want to change it to maven repository but what is needed to invoke to set such property?
You just have to use the artifactStorePath() method from DownloadConfigBuilder class:
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);
I cloned the git repository , did a 'grep -R embedpostgresql *' and found the first hint in ru.yandex.qatools.embed.postgresql.config.DownloadConfigBuilder class. Then I tested by myself and it works!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.