Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Error - The type org.eclipse.swt.widgets.Button cannot be resolved. It is indirectly referenced from required .class file

The Gerrit link: https://git.eclipse.org/r/8163

Regards
Jeff


On Wed, Nov 7, 2012 at 12:29 PM, Jeff MAURY <jeffmaury@xxxxxxxxxxxxx> wrote:
This is à bug in tycho related to Babel 
I have submitted a patch through gerrit
But as I'm out of the office I cannot send the link
I will do it in few ours

Jeff

Le mercredi 7 novembre 2012, a écrit :

Thnx Jeff , thnx Tony!
I imported the package "org.eclipse.swt.widgets" and I added "org.eclipse.swt" lib to my dependencies, but the error is still there, when compiling with tycho.

Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime,
 ...
 org.eclipse.swt
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-Localization: locale/internationalization
Bundle-ClassPath: .
Import-Package: org.osgi.framework, org.eclipse.swt.widgets

The Error occures, when I am adding Babel-update-Site to my project' target-Platform:
..
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.babel.nls_eclipse_de.feature.group" version="4.2.0.v20120721043402"/>
</location>
..
This provokes the following Error:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.15.0:compile (default-compile) on project de.ivu.fare.rcp.plugin: Compilation failure: Compilation failure:
[ERROR] D:\1PROJEKTE\Neuentwicklung\de.ivu.fare.rcp\de.ivu.fare.rcp.plugin\src\main\java\de\ivu\fare\rcp\gui\preferences\PreferenceControl.java:[0,0]
[ERROR] package de.ivu.fare.rcp.gui.preferences;
[ERROR] ^
[ERROR] The type org.eclipse.swt.widgets.Button cannot be resolved. It is indirectly referenced from required .class files
[ERROR] 1 problem (1 error)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.15.0:compile (default-compile) on project de.ivu.fare.rcp.plugin: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
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:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
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:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: copied.org.apache.maven.plugin.CompilationFailureException: Compilation failure
at copied.org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:418)
at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.execute(AbstractOsgiCompilerMojo.java:179)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more


It seems, that one of the Bundles from the Babel Project requires org.eclipse.swt.widgets.Button, and this requirement cannot be resoved!

Question: Any Ideas, what I can do to solve that, if importing package "org.eclipse.swt.widgets" and Bundle "org.eclipse.swt"? does not help?


Even if swt is platform dependant you just need to import the base swt
bundle, al platform dependant fragments will be automatically added during
resolution by tycho and it will fic you

> *Situation:* I have an Eclipse RCP Application, which I am trying to
> build with tycho plugin for Eclipse.
> When I am executing my Eclipse Application inside of the IDe - the
> Application is executed normally.
> When using tycho to build the Application - the following error is thrown:
>
>
> The type org.eclipse.swt.widgets.Button cannot be resolved. It is indirectly referenced from required .class files
>
> *What I did :*
> In other cases where a "missing requirenments" exception was thrown, which
> I found - a missing transitive plugin-dependency was the reason<https://issues.sonatype.org/browse/TYCHO-400>
> .
>
> In my case an SWT widget "Button" is missing, so I am trying to import
> swt. SWT is platform dependant so I am importing swt inside of the *
> product*, as described here <http://wiki.eclipse.org/Tycho/FAQ>.
>
> Anyway, during compilation the error occurs again.
>
> *Question:*
> Do someone have any Idea, how to solve this Problem?
>
 


Hi Alexander,

So come around these types of indirect dependencies, you must import the
package in question in your bundle - in this case
"org.eclipse.swt.widgets". Alternatively, you can require "org.eclipse.swt"
in your bundle.

The error occurs because, Tycho is more strict in its compiler class path
than Eclipse itself. Eclipse more or less disregards the restrictions on
the various bundles during import/require so you don't have to be so strict
in your imports...

/Tonny




--
Jeff MAURY


"Legacy code" often differs from its suggested alternative by actually working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury



--
Jeff MAURY


"Legacy code" often differs from its suggested alternative by actually working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury

Back to the top