spring-cloud-contract
spring-cloud-contract copied to clipboard
Set contract repository credentials in settings.xml
Mentioned in https://github.com/spring-cloud/spring-cloud-contract/issues/678.
If possible set username and password in servers section in local settings.xml file, and let spring cloud contract maven plugin refer to the id of the server definition in the project pom.xml, thus it will not expose credentials to public.
Related to https://github.com/spring-cloud/spring-cloud-contract/issues/285
Which servers should it pick? I guess we would need to pass the server id or sth.
Define username/password personal settings.xml. https://maven.apache.org/settings.html
Yes, pick a server id in Spring Contract mavenplugin.
An example: http://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-plugin/usage.html
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<server>myserver</server>
</configuration>
</plugin>
Credentials in settings.xml
<settings>
...
<servers>
...
<server>
<id>myserver</id>
<username>myusername</username>
<password>mypassword</password>
</server>
...
</servers>
...
</settings>
+1 what the status of this? I'm try to push to the private repository.
You can pass creds manually. We're not reading them from settings.xml
Ok, thanks for help.
@marcingrzejszczak What the status of supporting passing of it through settings.xml
, since it created for storing user related settings and it's the common way in maven to handle stuff like this.
Proposed solution by @hantsy is acceptable for me.
Here is another proposition: For example you have:
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<baseClassForTests>com.example.ServiceAppTest</baseClassForTests>
<contractsRepositoryUrl>git://https://gitlab.com/Hronom/services-stubs.git</contractsRepositoryUrl>
</configuration>
</plugin>
For this config plugin will ask server in settings.xml
:
<settings>
...
<servers>
...
<server>
<id>https://gitlab.com/Hronom/services-stubs.git</id>
<username>myusername</username>
<password>mypassword</password>
</server>
...
</servers>
...
</settings>
No work has been done yet.