Bamboo spec proxy
Asked by Craig Tyler:

I'm trying to migrate an existing Bamboo plan (built in the UI) as a Java Spec to a repository.

I've committed the Java exported from the UI to bamboo-specs folder and when I run Scan for Spec I get the following error log. The fact that the Bamboo server is behind a proxy and the failure occurs one minute after the "Downloading" line implies there is an issue getting to the internet. The Bamboo server has proxy settings configured and can see the internet (e.g. the Atlassian Marketplace). Are there other proxy settings required to get this download to work?

```
09-Jun-2020 10:44:37	[INFO] Error stacktraces are turned on.09-Jun-2020 10:44:37	[INFO] Scanning for projects...09-Jun-2020 10:44:37	[INFO] Downloading: https://repo.maven.apache.org/maven2/com/atlassian/bamboo/bamboo-specs-parent/7.0.4/bamboo-specs-parent-7.0.4.pom09-Jun-2020 10:45:37	Unable to scan repository [snip] for Bamboo Specs09-Jun-2020 10:45:37	com.atlassian.bamboo.repository.RepositoryException: Unable to scan repository [snip] for Bamboo Specs09-Jun-2020 10:45:37		at com.atlassian.bamboo.configuration.external.rss.RepositoryStoredSpecsExecutionServiceImpl.lambda$runSpecsWithMaven$0(RepositoryStoredSpecsExecutionServiceImpl.java:194)09-Jun-2020 10:45:37		at java.util.concurrent.FutureTask.run(FutureTask.java:266)09-Jun-2020 10:45:37		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)09-Jun-2020 10:45:37		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)09-Jun-2020 10:45:37		at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)09-Jun-2020 10:45:37		at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)09-Jun-2020 10:45:37		at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)09-Jun-2020 10:45:37		at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)09-Jun-2020 10:45:37		at java.lang.Thread.run(Thread.java:748)09-Jun-2020 10:45:37	Caused by: com.atlassian.utils.process.ProcessTimeoutException: process timed out09-Jun-2020 10:45:37		at com.atlassian.utils.process.ExternalProcessImpl.wrapUpProcess(ExternalProcessImpl.java:664)09-Jun-2020 10:45:37		at com.atlassian.utils.process.ExternalProcessImpl.finish(ExternalProcessImpl.java:161)09-Jun-2020 10:45:37		at com.atlassian.utils.process.ExternalProcessImpl.execute(ExternalProcessImpl.java:114)09-Jun-2020 10:45:37		at com.atlassian.bamboo.configuration.external.rss.RepositoryStoredSpecsExecutionServiceImpl.lambda$runSpecsWithMaven$0(RepositoryStoredSpecsExecutionServiceImpl.java:181)09-Jun-2020 10:45:37		... 8 more
```


Answers:
author: Yevhen
body: Hi Craig! Yes, you are right, this is a networking error and it is caused by the fact that Maven cannot download libraries from Maven central. What happens when you add a specs repo in UI is:

\* Bamboo tests connection to a remote host, clones the repo

\* looks for bamboo-specs directory, and pom.xml in particular, to run a Maven build that will publish a plan (or whatever your specs code creates)

\* Bamboo will look for tools/apache-maven-$version/bin directory to use mvn executable to run a Maven build and will fall back to mvn if it does not find it (this can happen only if you delete tools/apache-maven directory or there are permissions issues etc)

\* This is good old Maven which means it'll will grab config from **${BAMBOO_DIR}/tools/apache-maven-$version/conf/settings.xml** or **\~/.m2/settings.xml** (if exists, \~/.m2/settings.xml is preferred over the one in conf)  

**Solution**:

Configure proxy in ${BAMBOO_DIR}/tools/apache-maven-$version/conf/settings.xml (it already has proxies block but commented out). Here's some docs to read and follow: <https://maven.apache.org/guides/mini/guide-proxies.html>

I have run a few tests with both settings.xml to malform them and build fails as expected, which means Maven does use settings.xml.