Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,6 @@ updates:
update-types:
- patch
- minor
milton-webdav:
patterns:
- "org.exist-db.thirdparty.com.ettrema:*"
update-types:
- patch
- minor
maven-plugins-apache:
patterns:
- "org.apache.maven.plugins:*"
Expand Down
56 changes: 50 additions & 6 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,58 @@ Useful build switches:
Maven resolves dependencies from these repositories (defined in `exist-parent/pom.xml`):

- **Releases:** Maven Central (direct) → exist-db proxy → exist-db → evolved-binary (all public)
- **Snapshots:** GitHub Packages (exist, exist-xqts-runner) → exist-db-snapshots → evolved-binary-snapshots

### GitHub Packages (authentication for SNAPSHOT builds)
- **GitHub Packages (releases):** `jackrabbit-webdav-jakarta` — transformed Jackrabbit WebDAV JAR used by `exist-webdav` ([PR #6364](https://github.com/eXist-db/exist/pull/6364))
- **Snapshots:** GitHub Packages (`exist`, `exist-xqts-runner`) → exist-db-snapshots → evolved-binary-snapshots

### GitHub Packages (authentication)

Some artifacts are hosted on GitHub Packages under the `eXist-db` org. GitHub requires authentication; without it Maven reports **401 Unauthorized**.

| Server id in `settings.xml` | Repository | Used for |
|-----------------------------|------------|----------|
| `github` | `eXist-db/exist` | eXist SNAPSHOT builds published to GitHub Packages |
| `github-xqts-runner` | `eXist-db/exist-xqts-runner` | `exist-xqts` conformance runner (SNAPSHOT) |
| `github-jackrabbit-webdav-jakarta` | `eXist-db/jackrabbit-webdav-jakarta` | `jackrabbit-webdav` compile dependency in `exist-webdav` |

Maven matches credentials by **repository id**: the `<id>` in each `<repository>` block in `exist-parent/pom.xml` must match a `<server><id>…</id>` in `~/.m2/settings.xml`. A PAT configured only as `github` is **not** applied to the other two repos.

**Option 1 – Skip modules that need GitHub Packages** (no auth needed):

- XQTS: `mvn -DskipTests package -pl '!exist-xqts'`
- WebDAV tests: `mvn -DskipTests package -pl '!exist-webdav'` (or skip tests only: `-Dtest=!* -pl exist-webdav` is not ideal; prefer `-pl '!exist-webdav'` for compile-only)

**Option 2 – Configure GitHub auth** (full build including `exist-webdav` and `exist-xqts`): add a GitHub PAT with **`read:packages`** (and org access to `eXist-db` packages) to `~/.m2/settings.xml`. Use the same token for all three server entries; only the `<id>` differs. See `.github/actions/maven-github-settings/action.yml` for the canonical format:

```xml
<servers>
<server>
<id>github</id>
<username>YOUR_GITHUB_USERNAME</username>
<password>YOUR_GITHUB_PAT</password>
</server>
<server>
<id>github-xqts-runner</id>
<username>YOUR_GITHUB_USERNAME</username>
<password>YOUR_GITHUB_PAT</password>
</server>
<server>
<id>github-jackrabbit-webdav-jakarta</id>
<username>YOUR_GITHUB_USERNAME</username>
<password>YOUR_GITHUB_PAT</password>
</server>
</servers>
```

When building from `develop` (or any SNAPSHOT version), Maven resolves `exist-xqts-runner` from `https://maven.pkg.github.com/eXist-db/exist-xqts-runner`. GitHub Packages requires authentication; without it you get **401 Unauthorized**.
If a previous resolve failed with 401, Maven may cache the failure as `*.lastUpdated` under `~/.m2/repository/`. After fixing `settings.xml`, delete that artifact directory or add `-U` on the next build.

**Option 1 – Exclude XQTS** (no auth needed): use `mvn -DskipTests package -pl '!exist-xqts'` to skip the XQTS module.
Example: verify Jackrabbit resolves after configuring auth:

**Option 2 – Configure GitHub auth** (if you need XQTS or a full build): add a GitHub PAT to `~/.m2/settings.xml` as server `github-xqts-runner` (and optionally `github` for eXist snapshots). See `.github/actions/maven-github-settings/action.yml` for the expected `<server>` format.
```bash
rm -rf ~/.m2/repository/org/exist-db/thirdparty/org/apache/jackrabbit/jackrabbit-webdav/2.22.3-jakarta-ee10
mvn dependency:get \
-Dartifact=org.exist-db.thirdparty.org.apache.jackrabbit:jackrabbit-webdav:2.22.3-jakarta-ee10 \
-U -Ddependency-check.skip=true
```

Further build options can be found at: [eXist-db Build Documentation](http://www.exist-db.org/exist/apps/doc/exist-building.xml "How to build eXist") and on the workflow files of this repo.

Expand All @@ -47,6 +90,7 @@ From the repo root:
- **All tests:** `mvn -V -B verify -Ddependency-check.skip -Dlicense.skip`
- **exist-core only:** add `--projects exist-core --also-make` to the above
- **Single test class:** `mvn -Dtest=fully.qualified.TestClass test --projects exist-core --also-make`
- **WebDAV round-trip tests:** `mvn test -pl extensions/webdav --also-make -Dtest=org.exist.webdav.WebDavRoundTripTest -Dsurefire.failIfNoSpecifiedTests=false` (requires `github-jackrabbit-webdav-jakarta` auth; litmus compliance runs in Docker CI)

**NOTE:**
In the above example, we switched the current (checked-out) branch from `develop` to `master`. We use the [GitFlow for eXist-db](#contributing-to-exist) process:
Expand Down
29 changes: 18 additions & 11 deletions exist-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -642,18 +642,13 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>fluent-hc</artifactId>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5-fluent</artifactId>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -1163,6 +1158,18 @@ The BaseX Team. The original license statement is also included below.]]></pream
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@

package org.exist.dom.persistent;

import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.client.fluent.Executor;
import org.apache.http.client.fluent.Request;
import org.apache.hc.client5.http.fluent.Executor;
import org.apache.hc.client5.http.fluent.Request;
import org.exist.TestUtils;
import org.exist.http.AbstractHttpTest;
import org.exist.test.ExistWebServer;
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
import org.exist.xmldb.DatabaseImpl;
import org.exist.xmldb.XmldbURI;
import org.junit.ClassRule;
Expand All @@ -44,14 +42,15 @@
import java.io.IOException;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.http.HttpStatus.SC_CREATED;
import static org.apache.hc.core5.http.HttpStatus.SC_CREATED;
import static org.apache.hc.core5.http.HttpStatus.SC_OK;
import static org.junit.Assert.*;

/**
* Tests for retrieving a document containing CDATA via
* various APIs.
*/
public class CDataIntergationTest {
public class CDataIntergationTest extends AbstractHttpTest {

@ClassRule
public static final ExistWebServer existWebServer = new ExistWebServer(true, false, true, true);
Expand All @@ -67,29 +66,21 @@ public void cdataRestApi() throws IOException {
final String uri = "http://localhost:" + existWebServer.getPort() + "/exist/rest/db";
final String docUri = uri + "/rest-cdata-test.xml";

final Executor executor = Executor
.newInstance()
.auth(TestUtils.ADMIN_DB_USER, TestUtils.ADMIN_DB_PWD)
.authPreemptive(new HttpHost("localhost", existWebServer.getPort()));
final Executor executor = AbstractHttpTest.createAuthenticatedExecutor(
existWebServer, TestUtils.ADMIN_DB_USER, TestUtils.ADMIN_DB_PWD);

// store document
final HttpResponse storeResponse = executor.execute(
assertEquals(SC_CREATED, executeForStatus(executor,
Request
.Put(docUri)
.put(docUri)
.addHeader("Content-Type", "application/xml")
.bodyByteArray(cdata_xml.getBytes(UTF_8))
).returnResponse();
assertEquals(SC_CREATED, storeResponse.getStatusLine().getStatusCode());
));

// retrieve document
final HttpResponse retrieveResponse = executor.execute(
Request
.Get(docUri)
).returnResponse();
try (final UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream()) {
retrieveResponse.getEntity().writeTo(baos);
assertEquals(cdata_xml, baos.toString(UTF_8));
}
final HttpResponseResult retrieved = executeForStatusAndBody(executor, Request.get(docUri));
assertEquals(SC_OK, retrieved.statusCode());
assertEquals(cdata_xml, retrieved.body());
}

@Test
Expand Down
Loading
Loading