Richard Zowalla created OPENJPA-3054:
----------------------------------------

             Summary:  OSGi/Karaf packaging is broken after the switch to the 
Jakarta namespace
                 Key: OPENJPA-3054
                 URL: https://issues.apache.org/jira/browse/OPENJPA-3054
             Project: OpenJPA
          Issue Type: Bug
            Reporter: Richard Zowalla


## Description

After moving to `jakarta.*`, the OSGi metadata and the Karaf feature still 
point to Java EE-era artifacts and version ranges. The `openjpa` bundle 
probably won't resolve in an OSGi container, and the `openjpa` Karaf feature 
probably can't be installed.

### 1. Bundle `Import-Package` ranges (`openjpa/pom.xml`, maven-bundle-plugin)

| Import | Current range | API version in build |
|---|---|---|
| `jakarta.persistence.*` | `[1.1.0,2.2)` (required) | 3.2.0 |
| `jakarta.jms.*` | `[1.1.0,1.2)` | 3.1.0 |
| `jakarta.transaction.*` | `[1.1,1.3)` | 2.0.1 |
| `jakarta.validation.*` | `[1.0.0,1.1)` | 3.0.2 |

`jakarta.persistence` is a required import, and no Jakarta Persistence 3.x 
bundle falls inside `[1.1.0,2.2)`, so the bundle can't resolve. The optional 
imports also won't wire to current APIs. Also, `javax.activation.xa*` is still 
listed.

### 2. Karaf feature (`openjpa-features/src/main/feature/feature.xml`)

- `mvn:org.eclipse.persistence/jakarta.persistence/2.1.0` looks like the result 
of a search-and-replace of `javax` to `jakarta`, and the artifact probably 
doesn't exist. It should be 
`jakarta.persistence:jakarta.persistence-api:${jakarta.persistence-api.version}`.
- It still uses the Geronimo `jta_1.1`, `annotation_1.0` and `el_1.0` spec 
bundles. These should be the Jakarta Transaction, Annotation and EL APIs.
- `commons-dbcp2` is hard-coded to `2.7.0`. It should use `${dbcp2.version}`, 
which is 2.14.0 (see the closed GitHub PR #86).
- The description still says "Apache OpenJPA 3".

## Proposed fix

- Set the import ranges to match the Jakarta API majors we build against. For 
example, `jakarta.persistence.*;version="[3.1,4)"`, and do the same for the 
others. Remove `javax.activation.xa*`.
- Rewrite `feature.xml` using the Jakarta API artifacts and the version 
properties from the root pom.
- Optionally, add a smoke test that runs `feature:install openjpa` in Karaf so 
this doesn't break again quietly. GitHub PR #6 tried this once.

## Related

OPENJPA-2888 and OPENJPA-2890 (outdated, their PRs are now closed).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to