@@ -96,23 +96,77 @@ generate_instructions() {
9696 <h1>Stainless SDK Maven Repository</h1>
9797 <p>This is the Maven repository for your Stainless Java SDK build.</p>
9898
99- <h1>Directions</h1>
100- <p>To use the uploaded Maven repository, add the following to your project's <code>pom.xml</code>:</p>
99+ <h2>Project configuration</h2>
100+
101+ <p>The details depend on whether you're using Maven or Gradle as your build tool.</p>
102+
103+ <h3>Maven</h3>
104+
105+ <p>Add the following to your project's <code>pom.xml</code>:</p>
106+ <pre><repositories>
107+ <repository>
108+ <id>stainless-sdk-repo</id>
109+ <url>https://pkg.stainless.com/s/${PROJECT} /${SHA} /mvn</url>
110+ </repository>
111+ </repositories></pre>
112+
113+ <h3>Gradle</h3>
114+ <p>Add the following to your <code>build.gradle</code> file:</p>
115+ <pre>repositories {
116+ maven {
117+ url "https://pkg.stainless.com/s/${PROJECT} /${SHA} /mvn"
118+ }
119+ }</pre>
120+
121+ <details>
122+ <summary><h3 style="display:inline-block">Configuring authentication (if required)<h3></summary>
123+
124+ <p>Some accounts may require authentication to access the repository. If so, use the
125+ following instructions, replacing <code>YOUR_STAINLESS_API_TOKEN</code> with your actual token.</p>
126+
127+ <h3>Maven with authentication</h3>
128+
129+ <p>First, ensure you have the following in your Maven <code>settings.xml</code> for repo authentication:</p>
130+ <pre><servers>
131+ <server>
132+ <id>stainless-sdk-repo</id>
133+ <configuration>
134+ <httpHeaders>
135+ <property>
136+ <name>Authorization</name>
137+ <value>Bearer YOUR_STAINLESS_API_TOKEN</value>
138+ </property>
139+ </httpHeaders>
140+ </configuration>
141+ </server>
142+ </servers></pre>
143+
144+ <p>Then, add the following to your project's <code>pom.xml</code>:</p>
101145 <pre><repositories>
102146 <repository>
103147 <id>stainless-sdk-repo</id>
104148 <url>https://pkg.stainless.com/s/${PROJECT} /${SHA} /mvn</url>
105149 </repository>
106150</repositories></pre>
107151
108- <p>If you're using Gradle, add the following to your <code>build.gradle</code> file:</p>
152+ <h3>Gradle with authentication</h3>
153+ <p>Add the following to your <code>build.gradle</code> file:</p>
109154 <pre>repositories {
110155 maven {
111- url 'https://pkg.stainless.com/s/${PROJECT} /${SHA} /mvn'
156+ url "https://pkg.stainless.com/s/${PROJECT} /${SHA} /mvn"
157+ credentials(HttpHeaderCredentials) {
158+ name = "Authorization"
159+ value = "Bearer YOUR_STAINLESS_API_TOKEN"
160+ }
161+ authentication {
162+ header(HttpHeaderAuthentication)
163+ }
112164 }
113165}</pre>
166+ </details>
114167
115- <p>Once you've added the repository, you can include dependencies from it as usual. See your
168+ <h2>Using the repository</h2>
169+ <p>Once you've configured the repository, you can include dependencies from it as usual. See your
116170 <a href="${GITHUB_SERVER_URL} /${GITHUB_REPOSITORY} /blob/${GITHUB_SHA} /README.md">project README</a>
117171 for more details.</p>
118172</body>
0 commit comments