Skip to content

Commit 4ac9216

Browse files
committed
Add mavenproject artifacts as implicit repository
Signed-off-by: Christoph Läubrich <[email protected]>
1 parent a1e492d commit 4ac9216

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

org.eclipse.m2e.bnd.ui/META-INF/MANIFEST.MF

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ Bundle-SymbolicName: org.eclipse.m2e.bnd.ui
55
Bundle-Version: 1.0.0.qualifier
66
Import-Package: aQute.bnd.build;version="[4.5.0,5.0.0)",
77
aQute.bnd.maven.lib.configuration;version="1.2.0",
8-
aQute.bnd.osgi;version="[7.0.0,8.0.0)"
8+
aQute.bnd.maven.lib.resolve;version="[1.3.0,2.0.0)",
9+
aQute.bnd.osgi;version="[7.0.0,8.0.0)",
10+
aQute.bnd.repository.fileset;version="[1.1.0,2.0.0)"
911
Require-Bundle: org.eclipse.equinox.common,
1012
org.eclipse.core.resources,
1113
org.eclipse.m2e.core,

org.eclipse.m2e.bnd.ui/src/org/eclipse/m2e/bnd/ui/BndPluginAdapter.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
*******************************************************************************/
1313
package org.eclipse.m2e.bnd.ui;
1414

15+
import java.io.File;
16+
import java.util.ArrayList;
17+
import java.util.Collection;
1518
import java.util.List;
1619
import java.util.Map;
1720
import java.util.Properties;
1821

22+
import org.apache.maven.artifact.Artifact;
1923
import org.apache.maven.project.MavenProject;
2024
import org.eclipse.core.resources.IProject;
2125
import org.eclipse.core.runtime.AdapterTypes;
@@ -29,6 +33,7 @@
2933
import aQute.bnd.build.Project;
3034
import aQute.bnd.build.Workspace;
3135
import aQute.bnd.maven.lib.configuration.BeanProperties;
36+
import aQute.bnd.maven.lib.resolve.ImplicitFileSetRepository;
3237
import aQute.bnd.osgi.Processor;
3338

3439
/**
@@ -60,12 +65,21 @@ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
6065
}
6166
}
6267
Processor processor = new Processor(processorProperties, false);
63-
68+
Collection<File> list = new ArrayList<File>();
69+
if (mp != null) {
70+
for (Artifact artifact : mp.getArtifacts()) {
71+
list.add(artifact.getFile());
72+
}
73+
}
74+
ImplicitFileSetRepository repository = new ImplicitFileSetRepository("Project Artifacts", list);
6475
// TODO propertiesFile = new BndConfiguration(project,
6576
// mojoExecution).loadProperties(builder);
77+
// TODO
78+
// aQute.bnd.maven.lib.resolve.BndrunContainer.getFileSetRepository(MavenProject)
6679

6780
Workspace standaloneWorkspace = Workspace.createStandaloneWorkspace(processor,
6881
mavenProject.getPomFile().getParentFile().toURI());
82+
standaloneWorkspace.addBasicPlugin(repository);
6983
if (mp == null) {
7084
standaloneWorkspace.set("workspaceName", mavenProject.getArtifactKey().toPortableString());
7185
} else {
@@ -76,6 +90,7 @@ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
7690
standaloneWorkspace.set("workspaceDescription", description);
7791
}
7892
}
93+
standaloneWorkspace.refresh();
7994
Project bndProject = new Project(standaloneWorkspace, null, null);
8095
bndProject.setBase(null);
8196
return adapterType.cast(bndProject);

0 commit comments

Comments
 (0)