Dr.Death
Dr.Death

Reputation: 93

Install AspectJ Eclipse

I'm trying to get started with aspect oriented programming. I'm using latest eclipse (currently 12-2019)

public aspect Observer {

}

This Results in an error Syntax error on token "aspect", interface expected

According to https://www.eclipse.org/ajdt/downloads

I added http://download.eclipse.org/tools/ajdt/43/update

as an update site to eclipse

Eclipse AspectJ Install Site

However eclipse tells me that some parts could not be installed

Install Error

It looks Like some parts are missing

Cannot complete the install because one or more required items could not be found. Software being installed: AspectJ Development Tools 2.2.3.e43x-RELEASE-20130627-0800 (org.eclipse.ajdt.feature.group 2.2.3.e43x-RELEASE-20130627-0800) Missing requirement: AspectJ 1.7.3.20130613144500-a (org.aspectj.ajde 1.7.3.20130613144500-a) requires 'osgi.bundle; org.eclipse.core.runtime.compatibility 0.0.0' but it could not be found Cannot satisfy dependency: From: AspectJ Compiler 1.7.3.20130613144500-a (org.aspectj.feature.group 1.7.3.20130613144500-a) To: org.eclipse.equinox.p2.iu; org.aspectj.ajde [1.7.3.20130613144500-a,1.7.3.20130613144500-a] Cannot satisfy dependency: From: AspectJ Development Tools 2.2.3.e43x-RELEASE-20130627-0800 (org.eclipse.ajdt.feature.group 2.2.3.e43x-RELEASE-20130627-0800) To: org.eclipse.equinox.p2.iu; org.aspectj.feature.group [1.7.3.20130613144500-a,1.7.3.20130613144500-a]

How could I Get Aspects to run in Eclipse? Could you help me out?

Upvotes: 1

Views: 2476

Answers (1)

Dudi Boy
Dudi Boy

Reputation: 4865

Your problem caused by the removal of org.eclipse.core.runtime.compatibility plugin from Eclipse 4.6 .

Read more about this problem here.

The correct solution is to:

Install AspectJ from the correct download link.

The most updated to Eclipse 4.10 is: http://download.eclipse.org/tools/ajdt/410/dev/update

Another solution is to:

  1. Uninstall Eclipse.

  2. Install Eclipse 4.3 (matching your AspectJ version) .

  3. Retry AspectJ install.

The more complex solution is:

  1. Locate and build/extract org.eclipse.core.runtime.compatibility jar file from Maven repository.

  2. Put org.eclipse.core.runtime.compatibility jar file into Eclipse plugins directory.

  3. Run eclipse in --clean mode to rebuild and register the added plugin.

  4. Retry AspectJ install.

You might encounter more missing dependencies for org.eclipse.core.runtime.compatibility, eventually will have to load all the related plugins (long effort).

Upvotes: 5

Related Questions