Systems-Modeling / SysML-v2-Pilot-Implementation

Proof-of-concept pilot implementation of the SysML v2 textual notation and visualization
GNU Lesser General Public License v3.0
127 stars 24 forks source link

API client inaccessible from dependent plugin project #370

Closed s0mark closed 2 years ago

s0mark commented 2 years ago

SysMLv2 Pilot Implementation version: 2022-05 (commit: ST6RI-545 Updated constraint in RiskMetadata::Level to use "that". on June 15th, 2022)

Steps to reproduce:

The following project reproduces the problem: sysml.client.zip. The relevant part:

import org.omg.sysml.ApiClient;
import org.omg.sysml.ApiException;
import org.omg.sysml.Configuration;
import org.omg.sysml.api.CommitApi;
import org.omg.sysml.api.ProjectApi;
import org.omg.sysml.model.Commit;
import org.omg.sysml.model.Project;

//...

ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:9000"); // the SysML v2 API and Services pilot implementation is used
ProjectApi projectApi = new ProjectApi(defaultClient);
CommitApi commitApi = new CommitApi(defaultClient);
try {
    Project project = projectApi.postProject(new Project());
    Commit commit = commitApi.postCommitByProject(project.getAtId(), new Commit(), null);
} catch (ApiException e) {
    // ...
}

Expected output: The code compiles and runs without an exception, the appropiate requests are sent.

Actual output: The code does not compile, instead the following compile errors arise:

ApiClient cannot be resolved to a type
ApiException cannot be resolved to a type
CommitApi cannot be resolved to a type
CommitApi cannot be resolved to a type
Commit cannot be resolved to a type
Commit cannot be resolved to a type
Configuration cannot be resolved
ProjectApi cannot be resolved to a type
ProjectApi cannot be resolved to a type
Project cannot be resolved to a type
Project cannot be resolved to a type
The import org.omg.sysml.api cannot be resolved
The import org.omg.sysml.api cannot be resolved
The import org.omg.sysml.ApiClient cannot be resolved
The import org.omg.sysml.ApiException cannot be resolved
The import org.omg.sysml.Configuration cannot be resolved
The import org.omg.sysml.model cannot be resolved
The import org.omg.sysml.model cannot be resolved

Additional info: Adding the API jar directly as a dependency will remove compile errors, but instead causes a LinkageError in runtime, revealing that the API classes are already loaded. This suggests that the API package isn't properly exported from the org.omg.sysml plugin.

We believe that the jar file should not be added as an extra classpath entry, and the api packages should be exported.

seidewitz commented 2 years ago

I have submitted this as a bug report to our internal Jira issue tracking system.

seidewitz commented 2 years ago

See PR #374.

seidewitz commented 2 years ago

This is fixed in release 2022-06.