PCM Development/Solutions for Compilation Errors

Aus SDQ-Wiki
Wechseln zu: Navigation, Suche

This page describes possible problems that may arise when you compile PCM plug-in sources in your local Eclipse or if your Eclipse compiles the generated code for SimuCom.

Any type of compilation problem

  • Build all projects anew with Project -> Build clean, then select all projects.
  • Restart Eclipse with the -clean flag if your workspace is somehow messed up and you have trouble with available plugins or depedencies. It makes Eclipse read in the available plugins and dependencies again.
    • from the Eclipse help: if set, any cached data used by the OSGi framework and eclipse runtime will be wiped clean. This will clean the caches used to store bundle dependency resolution and eclipse extension registry data. Using this option will force eclipse to reinitialize these caches.
    • It's better to remove the flag again after successful start-up because staring Eclipse with -clean takes 2-3 times longer[1]

Classes cannot be resolved

Problem (any of the ones below)

The import <packagename> cannot be resolved
<classname> cannot be resolved
<classname> cannot be resolved to a type

Eclipse cannot find the classes that are required by your plug-ins. Probably, the plug-ins containing the classes are not found. Usually, plug-ins have a name similar to the missing package name. This problem can have several reasons.

If you do not know which plug-in contains your classes, check the prefixes at PCM Codebereiche and search for the plug-in in the SVN.

You can see which plug-ins are currently referenced by you plug-in by opening the "Plug-In Dependencies" entry of you plug-in project in the Java View.

Plug-in is actually missing

Check your Eclipse configuration at Help -> About Eclipse -> Installation details -> Plug-ins. Sort by the column Plug-in ID and check whether the plugin containing your missing classes is available (usually a similar ID). If it is not available, you either have to get it from an update site or import a project with the sources into your workspace and build it yourself.

Plug-in version is wrong

Check whether the versions of the plug-ins in your Eclipse match the version you need or expect. Plug-ins that you have built yourself have a version number in the format x.x.x.qualifier. Plug-ins from update sites have the version number format x.x.x.v<year><month><day>

Plug-in is there, but cannot be resolved when building

Sometimes source code cannot be built against plug-ins that are actually available in your Eclipse. The exact reason for this is unknown to us.

Example

You have an Eclipse with all PCM plug-ins freshly from the Nightly Build update site. You checkout and try to build the project de.uka.ipd.sdq.codegen.simucontroller. You get error messages like

The import ch cannot be resolved
RemoteOSGiService cannot be resolved
URL cannot be resolved to a type

From the detailed error messages, you see that Eclipse cannot find classes from the package ch.ethz.iks.r_osgi. However, the plug-in with exactly that name is available in your eclipse in version 1.0.0, and you have also checked that the plug-in does contain the required classes.

Solution

Check out the problematic plug-in from the SVN (here: from Palladio.Wrapper/trunk/) and import the plug-in into your workspace. Then, Eclipse will manage to built against these sources and the errors disappear.

Special Case: Generated Code misses Plug-ins

Consider the following scenario:

  • Eclipse is used with all PCM plug-ins installed
  • This Eclipse is used with workspace A
  • In workspace A, several PCM plug-ins are checked out and edited
  • To test and run the adapted PCM, an Eclipse runtime instance is launched from the Eclipse running on workspace A
  • This runtime instance uses workspace B

Now, it can happen that compilation errors result in the generated Code of the PCM simulation in workspace B. You verify that the plug-ins are available in the target Eclipse instance in the right version (x.x.x.qualifier), but still, the plug-ins are not found when building the generated simulation code.

Again, to make the generated code reference the adapted plug-ins, make sure these plug-ins are available in workspace B as well. Then, the generated code automatically references these projects. Import the checked out projects from workspace A to workspace B to solve the problem.

WTP metadata

Problem: Error message in the problem view "This project needs to migrate WTP metadata"

Solution: Right-click on the project and select "Validate". If the error persists, do the following: Use the "Navigator" view in Eclipse. Edit the file .project and remove the following line to get rid of the error.

<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>

References

Keywords: Plugin, Plug-in, Compile, Compiling, Error, Eclipse