java - Import cannot be resolved by test plugin fragment using Tycho but works in Eclipse -


i have plugin project trying create test plugin for. packages in plugin project available other plugins in workspace, including test plugin, when try , build projects using tycho test plugin throwing error stating import cannot resolved.

[error] failed execute goal org.eclipse.tycho:tycho-compiler-plugin:0.25.0:compile (default-compile) on project redacted.tests: compilation failure: compilation failure: [error] redacted/planimporttest.java:[7] [error] import redacted.pluginname.argument; [error] ^^^^^^^^^^^^ [error] import redacted.pluginname cannot resolved 

i new tycho think there issue project layout, can't find solution problem online. know why import working in eclipse not when running maven/tycho build on command line? relevant files below.

plugin manifest:

manifest-version: 1.0 bundle-manifestversion: 2 bundle-name: redacted.pluginname bundle-symbolicname: redacted.pluginname;singleton:=true bundle-version: 1.0.0.qualifier export-package: redacted bundle-requiredexecutionenvironment: javase-1.8 eclipse-buddypolicy: registered eclipse-registerbuddy: redacted 

plugin pom:

<project>     <modelversion>4.0.0</modelversion>     <parent>         <groupid>redacted</groupid>         <artifactid>redacted</artifactid>         <version>1.0.0-snapshot</version>         <relativepath>redacted</relativepath>     </parent>     <groupid>redacted</groupid>     <artifactid>redacted.pluginname</artifactid>     <version>1.0.0-snapshot</version>     <packaging>eclipse-plugin</packaging> </project> 

test class

import static org.junit.assert.*; import org.junit.test; import redacted.pluginname.argument;  public class planimporttest {      @test     public void test() {         argument = null;         asserttrue(true);     } } 

test project manifest:

manifest-version: 1.0 bundle-manifestversion: 2 bundle-name: redacted bundle-symbolicname: redacted.tests bundle-version: 1.0.0.qualifier bundle-vendor: redacted fragment-host: redacted.pluginname;bundle-version="1.0.0.qualifier" bundle-requiredexecutionenvironment: javase-1.8 require-bundle: org.junit;bundle-version="4.12.0" 

test project pom:

<project>     <modelversion>4.0.0</modelversion>     <parent>         <groupid>redacted</groupid>         <artifactid>redacted</artifactid>         <version>1.0.0-snapshot</version>         <relativepath>redacted</relativepath>     </parent>     <groupid>redacted</groupid>     <artifactid>redacted.tests</artifactid>     <version>1.0.0-snapshot</version>     <packaging>eclipse-test-plugin</packaging>     <build>         <plugins>             <plugin>                 <groupid>org.eclipse.tycho</groupid>                 <artifactid>tycho-surefire-plugin</artifactid>                 <configuration>                     <testclass>redacted.test</testclass>                     <dependencies>                         <dependency>                             <type>eclipse-plugin</type>                             <groupid>redacted</groupid>                             <artifactid>redacted.pluginname</artifactid>                             <version>1.0.0-snapshot</version>                         </dependency>                     </dependencies>                 </configuration>             </plugin>         </plugins>     </build> </project> 

as using fragment, additional dependency fragment host in pom.xml should not needed.

one thing seems incomplete in question me use of buddy classloading. in case classes compiling against provided buddy of bundle under test (not bundle itself), may have add extrarequirement buddy(ies), see https://eclipse.org/tycho/sitedocs/tycho-surefire/tycho-surefire-plugin/test-mojo.html#dependencies

for debugging purposes, can use maven cli option -x dump bundles calculated included in test runtime. way can spot if there bundle missing.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -