|
45 | 45 |
|
46 | 46 | is_enabled = 'ENABLE_STANDALONE_UNITTESTS' in os.environ and os.environ['ENABLE_STANDALONE_UNITTESTS'] == "true"
|
47 | 47 | MVN_CMD = [shutil.which('mvn')]
|
48 |
| -if 'MAVEN_REPO_OVERRIDE' in os.environ: |
49 |
| - MVN_CMD += ['-Dmaven.repo.remote=' + os.environ['MAVEN_REPO_OVERRIDE']] |
50 | 48 |
|
51 | 49 | def run_cmd(cmd, env, cwd=None):
|
52 | 50 | process = subprocess.Popen(cmd, env=env, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, text=True)
|
@@ -110,6 +108,31 @@ def test_polyglot_app():
|
110 | 108 | out = run_cmd(cmd, env)
|
111 | 109 | assert "Creating polyglot java python application in directory " + target_dir in out
|
112 | 110 |
|
| 111 | + if custom_repos := os.environ.get("MAVEN_REPO_OVERRIDE"): |
| 112 | + repos = [] |
| 113 | + for idx, custom_repo in enumerate(custom_repos.split(",")): |
| 114 | + repos.append(f""" |
| 115 | + <repository> |
| 116 | + <id>myrepo{idx}</id> |
| 117 | + <url>{custom_repo}</url> |
| 118 | + <releases> |
| 119 | + <enabled>true</enabled> |
| 120 | + </releases> |
| 121 | + <snapshots> |
| 122 | + <enabled>true</enabled> |
| 123 | + </snapshots> |
| 124 | + </repository> |
| 125 | + """) |
| 126 | + with open(os.path.join(target_dir, "pom.xml"), "r") as f: |
| 127 | + contents = f.read() |
| 128 | + with open(os.path.join(target_dir, "pom.xml"), "w") as f: |
| 129 | + f.write(contents.replace("</project>", """ |
| 130 | + <repositories> |
| 131 | + """ + '\n'.join(repos) + """ |
| 132 | + </repositories> |
| 133 | + </project> |
| 134 | + """)) |
| 135 | + |
113 | 136 | cmd = MVN_CMD + ["package", "-Pnative"]
|
114 | 137 | out = run_cmd(cmd, env, cwd=target_dir)
|
115 | 138 | assert "BUILD SUCCESS" in out
|
|
0 commit comments