Search code examples
javamavenwso2osgi-bundle

How to give an output directory in maven bundle plugin


I started creating an OSGI bundle. So It works fine. But when I put output directory in configuration section in maven bundle plugin, it won't add any of compiled classes. simply say, the classpath is empty.I am also using maven compiler plugin. Are they conflicting each other? Is there anything which I configured in a wrong way. This is the build section of my pox.xml file.

  <build>
  <plugins>

      <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.1</version>
          <configuration>
              <source>1.7</source>
              <target>1.7</target>
          </configuration>
      </plugin>

      <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>1.4.0</version>
          <extensions>true</extensions>
          <configuration>
              <instructions>
                  <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                  <Bundle-Name>${project.artifactId}</Bundle-Name>
                  <Export-Package>
                      demo.wso2.orderprocess.*
                  </Export-Package>
              </instructions>
              <outputDirectory>/home/wso2/product/wso2esb-4.9.0/repository/components/dropins</outputDirectory>
          </configuration>
      </plugin>

  </plugins>


Solution

  • You should use <buildDirectory>/home/wso2/product/wso2esb-4.9.0/repository/components/dropins</buildDirectory> instead of <outputDirectory>/home/wso2/product/wso2esb-4.9.0/repository/components/dropins</outputDirectory>. It did the trick for me, so now I can increase the speed of the OSGI bundles development!

    Reference: Maven Bundle Plugin documentation