Skip to content

Commit

Permalink
The hamcrest artifact from maven is not a bundle, use servicemix instead
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed Jul 18, 2023
1 parent 25e7426 commit 8036c74
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public class MavenBundleResolver {
*/
public Optional<ResolvedArtifactKey> resolveMavenBundle(MavenProject project, MavenSession mavenSession,
MavenArtifactKey mavenArtifactKey) {
if (project == null) {
return Optional.empty();
}
TargetPlatform tp = TychoProjectUtils.getTargetPlatformIfAvailable(DefaultReactorProject.adapt(project));
String type = mavenArtifactKey.getType();
String resolvedType = PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE.equals(type) ? ArtifactType.TYPE_ECLIPSE_PLUGIN
Expand All @@ -88,6 +91,9 @@ public Optional<ResolvedArtifactKey> resolveMavenBundle(MavenProject project, Ma
}
}
// then fallback to maven artifact ...
if (mavenSession == null) {
return Optional.empty();
}
String groupId = mavenArtifactKey.getGroupId();
String artifactId = mavenArtifactKey.getArtifactId();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ public static Optional<IInstallableUnit> getBundleIU(File bundleLocation) throws
}
PublisherInfo publisherInfo = new PublisherInfo();
publisherInfo.setArtifactOptions(IPublisherInfo.A_INDEX);
IArtifactKey key = BundlesAction.createBundleArtifactKey(bundleDescription.getSymbolicName(),
String symbolicName = bundleDescription.getSymbolicName();
if (symbolicName == null) {
return Optional.empty();
}
IArtifactKey key = BundlesAction.createBundleArtifactKey(symbolicName,
bundleDescription.getVersion().toString());
IArtifactDescriptor descriptor = FileArtifactRepository.forFile(bundleLocation, key);
return Optional.ofNullable(publishBundle(bundleDescription, descriptor, publisherInfo));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public Map<TargetEnvironment, P2ResolutionResult> resolveArtifactDependencies(Ta
Collection<? extends ArtifactKey> artifacts) {
P2TargetPlatform targetPlatform = getTargetFromContext(context);
Collection<IInstallableUnit> roots = new ArrayList<>();
QueryableCollection queriable = new QueryableCollection(targetPlatform.getInstallableUnits());
for (ArtifactKey artifactKey : artifacts) {
QueryableCollection queriable = new QueryableCollection(targetPlatform.getInstallableUnits());
VersionRange range = new VersionRange(artifactKey.getVersion());
IQuery<IInstallableUnit> query = ArtifactTypeHelper.createQueryFor(artifactKey.getType(),
artifactKey.getId(), range);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public interface JUnitClasspathContainerEntry extends ClasspathContainerEntry {
static final JUnitBundle JUNIT4_PLUGIN = JUnitBundle.of("org.junit", "[4.13.0,5.0.0)",
"org.apache.servicemix.bundles", "org.apache.servicemix.bundles.junit");

static final JUnitBundle HAMCREST_CORE_PLUGIN = JUnitBundle.of("org.hamcrest.core", "[1.1.0,2.0.0)", "org.hamcrest",
"hamcrest-core");
static final JUnitBundle HAMCREST_CORE_PLUGIN = JUnitBundle.of("org.hamcrest.core", "[1.1.0,2.0.0)",
"org.apache.servicemix.bundles", "org.apache.servicemix.bundles.hamcrest");

static final JUnitBundle JUNIT_JUPITER_API_PLUGIN = JUnitBundle.of("junit-jupiter-api", "[5.0.0,6.0.0)",
"org.junit.jupiter", "junit-jupiter-api");
Expand Down

0 comments on commit 8036c74

Please sign in to comment.