简体   繁体   中英

Migrating from maven to bazel

Hi I am trying to migrate my project from maven to bazel. One of the challenge I am facing is migrating test configuration.

While initializing the test, code writes some config properties to properties file. In one of the test configuration, it tries to create this properties file in "/target" location which maven creates by default.

But after migrating those tests to run with bazel, it doesnt find the folder named target and hence fail the tests.

Changing each and every test with the different folder will be huge task. Is there a way in bazel to create maven like folder structure ?

Bazel runs tests in a directory denoted by the environment variable $TEST_SRCDIR and has access to a temp directory $TEST_TMPDIR during the test. I believe the only approach here would be the augment every test to either not write to target/ , or write to $TEST_TMPDIR instead of target/ .

Also, unlike Maven, Bazel does not allow your tests to write to your sources' directory. This is to ensure reproducibility and hermeticity, and is the reason why Bazel runs tests in a separate clean room environment created independently for each test.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM