Install AspectJ Eclipse - java

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
However eclipse tells me that some parts could not be installed
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?

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:
Uninstall Eclipse.
Install Eclipse 4.3 (matching your AspectJ version) .
Retry AspectJ install.
The more complex solution is:
Locate and build/extract org.eclipse.core.runtime.compatibility jar file from Maven repository.
Put org.eclipse.core.runtime.compatibility jar file into Eclipse plugins directory.
Run eclipse in --clean mode to rebuild and register the added plugin.
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).

Related

Eclipse plugin code can't find "javax.inject.Inject" class, plugin jars now not in plugins directory

I'm trying to debug an Eclipse plugin that developed a bug around the 2019-09 timeframe. Something must have changed in the platform that causes it not to work anymore.
I can run the rcp 2018-12 distro and test it, and I verify that it works. I was able to step through the handler code.
If I run the 2019-12 distro, I can't fully compile the project, as it says "The type javax.inject.Inject cannot be resolved.". When I try to open type javax.inject.Inject in the 2018-12 distro, it finds it in "eclipse/plugins/javax.inject_1.0.0.v20091030.jar" in the distro. When I inspect that "plugins" directory, I find lots of separate plugin jars.
In the 2019-12 distro, it can't find javax.inject.Inject, and when I look in that plugins directory, I only find a single jar, the "org.eclipse.equinox.launcher" jar.
I remember this subject of the single launcher jar, but I don't know if this is a direct cause of this compile error, or what I have to do to move forward.
Update:
In response to the much appreciated answer, here's what I found:
I do find a ~/.p2 directory, and I found the javax.inject plugin in there. When I inspect the "Target Platform" settings, I see very similar information in both the 2018-12 and 2019-12 instance (plugin count varies by a very small number).
I inspected all of the MANIFEST.MF files, and none of them have a single "Import-Package" statement. I understand the advice is to add one, but I'd like to understand why I'm NOT seeing an error in 2018-12.
When I look at the "Plug-in Dependencies" list in the Project Explorer, I see "javax.inject" in the list in 2018-12, but I don't see it in 2019-12.
When I select the MANIFEST.MF file and view it in the form mode and select "Dependency Analysis" and then "Show the plug-in dependency hierarchy", I can then see that "org.eclipse.core.runtime", which is version 3.15... in 2018-12 and version 3.17... in 2019-12 has different dependencies. In particular, in 3.15, one of the dependencies is "javax.inject". In 3.17, that is not one of its dependencies.
So, I can see that a possible solution is definitely to add an "Import-Package" for "javax.inject", but can you explain why it might be that NONE of the MANIFEST.MF files have a single "Import-Package" statement as of yet?
If you are using an Eclipse installed with the Oomph installer the plugins can be in a different location (the .p2 direcory in your home directory I think). The javax.inject plugin should still be present along with all the other Eclipse plugins.
Plugins normally reference javax.inject using Import-Package in the MANIFEST.MF rather than specifying the required plugin use Require-Package so:
Import-Package: javax.inject
There haven't been any significant changes in this area between 2018-12 and 2019-12. The version of javax.inject is still exactly the same.
Check what you have configured as your Target Platform (Preferences > Plug-in Development > Target Platform) - that determines what plug-ins are available.
Update:
The reason you now need to add the Import-Package is the change made by Eclipse bug 487676 which removed the 're-export' of the javax.inject dependency from org.eclipse.core.runtime so that you now have to explicitly add it. This is also documented in the Whats New for Eclipse 2019-09 (4.13)

What correct maven dependencies to specify for JBehave tutorial project?

I want to study the java spring portion of the Jbehave-tutorial project at https://github.com/jbehave/jbehave-tutorial.
The README.MD states the REQUIREMENTS for building at the bottom:
Building the tutorial has been tested with Maven 3.0.5-3.2.1 and JDK 1.6-1.7. Newer versions of Maven and JDK should work but could also present issues.If you find any, please report them via JIRA
On my computer My Computer I am running Maven Version: 3.3.3 and STS Version: 3.6.4 for 64-bit Windows 7.
I really don't want to make an Atlassian account in order to resolve this issue if I can resolve it on StackOverflow.
So these are the steps I took to build JBehave-tutorial on my machine:
git clone https://github.com/jbehave/jbehave-tutorial.git
mvn clean install -Pstable # Issued in the main parent folder 'jbehave-tutorial'
Imported into Spring Tool Suite (STS) as an existing maven project.
Received the following errors in STS:
This lead me to believe that maven did not correctly download and build those dependencies so I looked into the .m2\repository\org\jbehave folder and this is what I seen.
Did anybody else get this to work?
What workarounds are there?
What correct maven dependencies to specify for JBehave tutorial project in pom.xml(s)?
I'm not immediately clear on your specific situation but here are dependencies required to use JBehave without Spring. (example pom below - you'll only need gherkin if your user scenarios are in gherkin).
https://stackoverflow.com/questions/30685909/jbehave-dependencies-not-available-in-central-maven-repo
I'm also going to hazard a guess that you're going to need the below at the appropriate version.
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-spring</artifactId>
<version>4.0.3</version>
</dependency>
Maven cannot find "SNAPSHOT" dependencies.
You need to google "Maven + dependency name without specified version" and check what is the latest version of them and make appropriate changes in pom file.
For example I have jbehave-web-runner version 3.6-beta-2 NOT 3.6-SNAPSHOT.

Sample Guestbook GAE Project - 'Plugin execution not covered by lifecycle configuration'

I'm new to programming (and web development) and thought it would be good practice to try and build the sample Google App Engine project through Google's tutorial.
Here are my notes, spanning vim/command line weirdness/other fun stuff -http://goo.gl/EfZ3Gm
For reference, I am using OS X Yosemite 10.10.3 (beta)
I started here - https://cloud.google.com/appengine/docs/java/gettingstarted/introduction
and followed all the command line instructions for Steps 1-3. I have Maven 3.2.5 installed, here is the output from my command prompt when I type 'mvn -v'
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T12:29:23-05:00)
Maven home: /usr/local/Cellar/maven/3.2.5/libexec
Java version: 1.7.0_75, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/jre
When I reach Step 4, I'd like to open the project in Eclipse, since I'm a bit more comfortable with looking at the code in an IDE.
Looking at the project's pom.xml file in the 'Overview' tab, I see the error -
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:versions-maven-plugin:2.1:display-plugin-updates (execution: default, phase: compile)
Looking at the code, I would guess it's because the maven referenced in the project doesn't match what I have installed on my machine? I see similar questions have been asked previously -
Plugin execution not covered by lifecycle configuration
Plugin error: execution not covered by lifecycle configuration
Plugin execution not covered by lifecycle configuration
But running 'mvn eclipse:eclipse' in my terminal window would negate all the work I did in Steps 1-3 with maven in the command prompt; I needed maven for these steps. And the second option involves installing Spring IDE - there has to be a better way than this, I hope!
When using eclipse with the m2e plugin (which is included standard and enables maven in eclipse), it will attempt to run plugins in your pom file as part of build for any maven enabled project.
For it to know what to do it uses an m2e-connector - there needs to be one for each plugin, installed into eclipse.
If it can't find one, it issues this error/warning.
If you press cmd-1 on the troublesome line, it will give you a few options. They boil down to 'ignore this'. One will modify your pom file to include a maven plugin which controls the configuration of eclipse, or add a clause to it if already present. The other saves the 'ignore this' configuration into eclipse settings.
This should remove the warning/error, and make no difference to your development environment.
In the case that this plugin is crucial, you'll need to locate an m2e-connector. They generally don't exist - so you'd probably be out of luck. In this case, it just spits out a report telling you if there are any more recent versions of dependencies available and has no impact on your build, so don't worry about it.
I strongly advise against using mvn eclipse:eclipse, especially with appengine apps. It won't use the correct library setup for your app to run properly.

Maven integrating in Eclipse RAD impossible

I'm using RAD and since the morning I'm trying to integrate Maven with Eclipse(RAD) by using that command:
Help -> Instal New Software, then putting this link:
http://download.eclipse.org/m2e-wtp/releases/
then checked "Maven integration for Eclipse"
the errors occured below:
Cannot complete the install because of a conflicting dependency.
Software being installed: m2e - Maven Integration for Eclipse 1.4.0.20130601-0317 ( org.eclipse.m2e.feature.feature.group 1.4.0.20130601-0317)
Software currently installed: Shared profile 1.0.0.1376390079411 (SharedProfile_bootProfile 1.0.0.1376390079411)
Only one of the following can be installed at once:
Eclipse Jobs Mechanism 3.5.2.R36x_v20110419 (org.eclipse.core.jobs 3.5.2.R36x_v20110419)
Eclipse Jobs Mechanism 3.5.300.v20130429-1813 (org.eclipse.core.jobs 3.5.300.v20130429-1813)
Eclipse Jobs Mechanism 3.5.101.v20120113-1953 (org.eclipse.core.jobs 3.5.101.v20120113-1953)
Cannot satisfy dependency:
From: Shared profile 1.0.0.1376390079411 (SharedProfile_bootProfile 1.0.0.1376390079411)
To: org.eclipse.core.jobs [3.5.2.R36x_v20110419]
Cannot satisfy dependency:
From: Equinox Provisioning Discovery 1.0.101.v20130327-2119 (org.eclipse.equinox.p2.discovery.compatibility 1.0.101.v20130327-2119)
To: bundle org.eclipse.equinox.p2.transport.ecf 1.0.0
Cannot satisfy dependency:
From: Equinox Provisioning ECF based Transport 1.1.0.v20130516-1858 (org.eclipse.equinox.p2.transport.ecf 1.1.0.v20130516-1858)
To: bundle org.eclipse.core.jobs 3.5.100
Cannot satisfy dependency:
From: m2e Marketplace 1.4.0.20130601-0317 (org.eclipse.m2e.discovery 1.4.0.20130601-0317)
To: bundle org.eclipse.equinox.p2.discovery.compatibility 0.0.0
Cannot satisfy dependency:
From: m2e - Maven Integration for Eclipse 1.4.0.20130601-0317 (org.eclipse.m2e.feature.feature.group 1.4.0.20130601-0317)
To: org.eclipse.m2e.discovery [1.4.0.20130601-0317]
I have no idea what mentioned "Eclipse Jobs Mechanism... " is I can't find its in the installed software.
Tried to use another repositories like:
http://bitstrings.github.com/m2e-connectors-p2/releases
http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-mavenarchiver/0.15.0/N/0.15.0.201207090125/
They let me start the instalation but It's stop in +/- 40 %...
Anyone could help me install Maven in my IDE?
Thank You in advance
Did you use the maven installation instructions by IBM?
https://www.ibm.com/developerworks/community/wikis/form/anonymous/api/wiki/2fad2df2-9c68-4aa3-abba-01e910211998/page/5531e600-93c7-46f6-86f4-a570b1bcf391/attachment/9f11dc95-a9ae-4522-9ed1-2c8a7ca165cd/media/RAD_m2e-Nov(update%20Jun%202012).pdf
I have ceased installing m2e within RAD "myself" (in the sense of using an update site in Install New Software). Rather I use the option "Maven" via the IBM Installation Manager.
Is there any particular reason you are installing Maven using that update site link instead of installing it using Installation Manager? To install Maven using Installation Manager you just need to open IM and select the checkbox for Maven.
In case somebody still has to use this old version of RAD:
http://download.jboss.org/jbosstools/updates/m2eclipse-wtp/ does not work - it points to the latest version of m2e which requires a newer base-eclipse.
Instead, add all of the following locations:
http://download.eclipse.org/technology/m2e/releases/1.4/
http://download.jboss.org/jbosstools/updates/m2e-extensions/m2eclipse-wtp/
http://download.jboss.org/jbosstools/updates/m2e-extensions/m2e-mavenarchiver/

Problems installing m2eclipse plugin to Indigo: 'bundle org.eclipse.zest.core 0.0.0' could not be found

From Indigo Available Software screen I select maven integration for Eclipse , then Next. got the following error message (blank lines added for readability):
Cannot complete the install because one or more required items could not be found.
Software being installed: Maven Integration for Eclipse (Required) 0.12.1.20110112-1712 (org.maven.ide.eclipse.feature.feature.group 0.12.1.20110112-1712)
Missing requirement: Maven Integration for Eclipse (Editors) 0.12.1.20110112-1712 (org.maven.ide.eclipse.editor 0.12.1.20110112-1712) requires 'bundle org.eclipse.zest.core 0.0.0' but it could not be found
Cannot satisfy dependency:
From: Maven Integration for Eclipse (Required) 0.12.1.20110112-1712 (org.maven.ide.eclipse.feature.feature.group 0.12.1.20110112-1712)
To: org.maven.ide.eclipse.editor [0.12.1.20110112-1712]
You probably have an old update site. Version 1.0 is already available and your log shows 0.12.x. Check: http://eclipse.org/m2e/download/
Use: http://download.eclipse.org/technology/m2e/releases

Categories