title: Add maven dependencies of OSGi bundles to the Eclipse target platform
body: <p>I have some OSGi-bundles (plain OSGi, no eclipse dependencies) and a maven build with pax runner that launches them in a Knopflerfish server.</p>
  
  <p>The maven build and launching the bundles works perfectly fine but only via pax runner (<code>mvn pax:provision</code>).</p>
  
  <p>For debugging the bundles it would be nice though to launch them directly from within eclipse, otherwise my breakpoints won't trigger (seems obvious, as pax:provision launches built jar-files that are not tied to eclipse anymore).</p>
  
  <p>The MANIFEST.MF-file is built the usual maven-way, means using maven-bundle-plugin. Therefore launching the bundles directly from eclipse fails because the eclipse platform misses all that required external OSGi-bundles that maven gets doing it's maven magic.</p>
  
  <p>Therefore I am looking for a way to set up my eclipse target platform somehow so that the OSGi-bundles from maven are automatically included and can be accessed from within the IDE for resolving the constraints at launch time.</p>
  
  <p>I checked the target platform settings, but apparently one can only add specific jars and folders to it, not whole folder structures like it would require to use the whole local maven repository. If I need to update my target platform for every new dependency thats going to get really ugly (I'd wish I could do something like "add C:\Users\myprofile.m2\repository to target platform" and eclipse would just load what it needs).</p>
  
  <p>While researching I found Eclipse Tycho but apparently this only compiles a target platform for building the bundles, but not for compiling and launching them from within the IDE. Next I found this site: <a href="http://andriusvelykis.github.io/pde-target-maven-plugin/" rel="nofollow">http://andriusvelykis.github.io/pde-target-maven-plugin/</a> And this looks like exactly what I need. From the documentation it seems that this plugin is able to take the target platform that is compiled from eclipse tycho and write it to a file. Then I am able to import this file back into my IDE and use it as target platform.</p>
  
  <p>The problem I have is, that the plugin quits with an error that I can't deduce (I turned on stacktraces for a more complete error message).</p>
  
  <pre><code>[ERROR] Failed to execute goal lt.velykis.maven:pde-target-maven-plugin:1.0.0:add-pom-dependencies (default-cli) on project orchestrator-parent: The parameters 'baseDefinition' for goal lt.velykis.maven:pde-target-maven-plugin:1.0.0:add-pom-dependencies are missing or invalid -&gt; [Help 1]
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal lt.velykis.maven:pde-target-maven-plugin:1.0.0:add-pom-dependencies (default-cli) on project orchestrator-parent: The parameters 'baseDefinition' for goal lt.velykis.maven:pde-target-maven-plugin:1.0.0:add-pom-dependencies are missing or invalid
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:220)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
  Caused by: org.apache.maven.plugin.PluginParameterException: The parameters 'baseDefinition' for goal lt.velykis.maven:pde-target-maven-plugin:1.0.0:add-pom-dependencies are missing or invalid
      at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:581)
      at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:534)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:97)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      ... 20 more
  [ERROR] 
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException
  </code></pre>
  
  <p>This is the configuration for the plugin:</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;lt.velykis.maven&lt;/groupId&gt;
              &lt;artifactId&gt;pde-target-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.0.0&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;pde-target&lt;/id&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;add-pom-dependencies&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;baseDefinition&gt;D:/platform.target&lt;/baseDefinition&gt;
                          &lt;outputFile&gt;D:/platform-pde.target&lt;/outputFile&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>I can see that the paths are correct because the <code>platform-pde.target</code> file is created, but it has the same content as the base file.</p>
  
  <p>File content (just a standard target platform that I created and shared as the base file):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;?pde version="3.8"?&gt;&lt;target name="OrchestratorPlatform" sequenceNumber="8"&gt;
  &lt;locations&gt;
  &lt;location path="${eclipse_home}" type="Profile"/&gt;
  &lt;/locations&gt;
  &lt;environment&gt;
  &lt;os&gt;win32&lt;/os&gt;
  &lt;ws&gt;win32&lt;/ws&gt;
  &lt;arch&gt;x86_64&lt;/arch&gt;
  &lt;nl&gt;en_US&lt;/nl&gt;
  &lt;/environment&gt;
  &lt;launcherArgs&gt;
  &lt;vmArgs&gt;-Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m&lt;/vmArgs&gt;
  &lt;/launcherArgs&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>What I am looking for are tips on how to configure the plugin correctly or any other ways I can bring my maven dependency bundles into my target platform so that I can launch the bundles directly from eclipse without having to maintain the dependencies somewhere in the depths of eclipse preferences again.</p>