Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Debugging with Tycho

Simon Kaufmann edited this page Aug 17, 2017 · 2 revisions

Attach a debugger

Instruct maven to wait for a debugger to be attached for test execution:

mvn clean install -DdebugPort=8000

Access to the OSGi console during test execution

Extra dependencies

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>target-platform-configuration</artifactId>
  <configuration>
    <environments combine.self="override"></environments>
    <dependency-resolution>
      <extraRequirements>
      
        <!-- ... -->
 
        <requirement>
          <type>eclipse-plugin</type>
          <id>org.eclipse.equinox.console</id>
          <versionRange>0.0.0</versionRange>
        </requirement>
        <requirement>
          <type>eclipse-plugin</type>
          <id>org.apache.felix.gogo.command</id>
          <versionRange>0.0.0</versionRange>
        </requirement>
        <requirement>
          <type>eclipse-plugin</type>
          <id>org.apache.felix.gogo.runtime</id>
          <versionRange>0.0.0</versionRange>
        </requirement>
        <requirement>
          <type>eclipse-plugin</type>
          <id>org.apache.felix.gogo.shell</id>
          <versionRange>0.0.0</versionRange>
        </requirement>
        
        <!-- ... -->
        
      </extraRequirements>
    </dependency-resolution>
  </configuration>
</plugin>

Start bundles automatically & enable console

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-surefire-plugin</artifactId>
  <configuration>
    <systemProperties>
    
      <!-- ... -->
    
      <osgi.console>1234</osgi.console>
      
      <!-- ... -->
      
    </systemProperties>
    <bundleStartLevel>
    
      <!-- ... -->
      
      <bundle>
        <id>org.eclipse.equinox.console</id>
        <level>4</level>
        <autoStart>true</autoStart>
      </bundle>
      <bundle>
        <id>org.apache.felix.gogo.command</id>
        <level>4</level>
        <autoStart>true</autoStart>
      </bundle>
      <bundle>
        <id>org.apache.felix.gogo.runtime</id>
        <level>4</level>
        <autoStart>true</autoStart>
      </bundle>
      <bundle>
        <id>org.apache.felix.gogo.shell</id>
        <level>4</level>
        <autoStart>true</autoStart>
      </bundle>
    
      <!-- ... -->
      
    </bundleStartLevel>
  </configuration>
</plugin>

Then you can

telnet localhost 1234

to the OSGi console and use it as usual.

Clone this wiki locally