Today, I'm going to share a problem which I think it's quite common:
- importing Java Maven projects into Eclipse and expecting Eclipse to just work with it.
You do:
1) sync from source control
2) import existing maven projects to eclipse
3) see many red errors in Eclipse.
4) yeah , I forgot to set the Maven settings file
5) still some projects are failing
6) try to fix each problem 1 by 1
Why does it happen like that?
Most common is that it will set a Java Compiler version which is from the POM.xml but then the JRE environment specified could be... just not right. So your POM.xml says "compiler version 1.7", but the Maven projects you import are automatically assigned Java1.5...
So errors like
- You cannot use @Override here
or for java1.7
- new ArrayList<> constructor not found (or not valid expression).
So you have to go to each project, reconfigure build path parameters to point to JRE1.7 manually, even though you have specified JDK1.7 as installed JDK.
Imagine fixing this manually for 20-50 projects (you've just been moved to moderately progressed project)
Even if you explicitly set the Maven settings in the Preferences menu, you would not solve your problem.
The single solution is to:
1) delete all projects (
only
from Eclipse )
2) reimport them, because NOW you have set the Maven settings BEFORE the importing...
Just crazy... not being able to automatically adapt the projects to the new maven settings file... not even "clean" and "maven update" help...
Best wishes,
Leni Kirilov
Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts
Friday, June 07, 2013
Saturday, July 10, 2010
Eclipse DemoCamp 2010
Here I'm going to tell every reader what amazed me and what I think is remarkable around Eclipse DemoCamp 2010 Sofia.
---
First of all I would like to give my special thanks to the organizers who managed to stay in schedule through the whole event - all presentations were exact, question sessions, no power surge problems, comfortable hall and of course top-class food and beverages prepared for the breaks.
I was impressed that the president of the Eclipse Foundation presented its goals and its history and path for the future - very interesting indeed to hear it from the man who has seen it all from the very beginning and gave birth to something that is accepted as a standard in the modern world - open-source foundation which holds and nurtures different projects under the hood of Eclipse.
There were a few presenters whose names I cannot write, because I don't remember them (sorry) but they covered the following areas:
- RAP
- OSGi bundled application server - Virgo
- Swordfish - framework for bundled enterprise services
- Rational - IBM's CASE non-free very functional software product
- context-depended language generator plug-in for Eclipse
1. Virgo
I was most impressed by the Virgo application server which is constructed using the ideology of bundled products (like Eclipse IDE) and the ease and plugability at runtime of small software components called bundles. In that way you can turn on/off features at runtime with no downtime and manage dependencies between different components.
Also you can create very light and feature-set specific application servers who can for example support only Servlets (web container) and you don't care about EJBs or Web Services and all you need are simple security and logging for example.
The man presenter was very young Spring (now VMWare) developer who demonstrated the Virgo server
and it started very quickly and redeployed applications with just a click and no waiting or whatever...
Just amazing! - Believe me, you will find it amazing if you have to do an enterprise application and deploying it on a heavy proprietary application server like NetWeaver, whose architecture is just not modern anymore. The bundle concept is unknown to it. Nevertheless still an excellent application server.
Don't forget scalability - using bundles would be much easier to manage dependencies and physical separation and transport.
2. Context-dependant language generator plug-in for Eclipse
There was an amazing demo of a framework which lets you easily define your own language and reserved words for it. After that you can easily create an Eclipse project specific for your new language and even have the editor validate your syntax and semantics!
The presenter Kiril did a great job and capture the audience - he was the winner of the Demo sessions.
3. Rational
The presenter was a guy from Croatia (sorry if I am wrong) and used not 1 but 4 presentation sessions to explain what Rational can and cannot do (actually, I think it can do everything, even prepare you a sandwich...)
So basically Rational is a CASE tool which covers all aspects of software development process:
- requirements engineering
- storing requirements and managing them
- preparing architecture
- design analysis
- bug tracker and connection to various requirements
- track exceptions with real code lines and bugs
- suggest improvements based on an exception
- complex statistics and diagrams which even the presenter was confused to explain
and many more
Believe me, if you know all the features of Rational and can use it productively you are a GOD.
Unfortunately not everybody in the audience appreciated the presenters attempt to cover high percentage of the products capabilities... His voice wasn't as clear as hoped either...
----
All in all I am very confident that I will attend the Eclipse Demo Camp next year and who knows - may be I'll present something of my own...
L.K.
---
First of all I would like to give my special thanks to the organizers who managed to stay in schedule through the whole event - all presentations were exact, question sessions, no power surge problems, comfortable hall and of course top-class food and beverages prepared for the breaks.
I was impressed that the president of the Eclipse Foundation presented its goals and its history and path for the future - very interesting indeed to hear it from the man who has seen it all from the very beginning and gave birth to something that is accepted as a standard in the modern world - open-source foundation which holds and nurtures different projects under the hood of Eclipse.
There were a few presenters whose names I cannot write, because I don't remember them (sorry) but they covered the following areas:
- RAP
- OSGi bundled application server - Virgo
- Swordfish - framework for bundled enterprise services
- Rational - IBM's CASE non-free very functional software product
- context-depended language generator plug-in for Eclipse
1. Virgo
I was most impressed by the Virgo application server which is constructed using the ideology of bundled products (like Eclipse IDE) and the ease and plugability at runtime of small software components called bundles. In that way you can turn on/off features at runtime with no downtime and manage dependencies between different components.
Also you can create very light and feature-set specific application servers who can for example support only Servlets (web container) and you don't care about EJBs or Web Services and all you need are simple security and logging for example.
The man presenter was very young Spring (now VMWare) developer who demonstrated the Virgo server
and it started very quickly and redeployed applications with just a click and no waiting or whatever...
Just amazing! - Believe me, you will find it amazing if you have to do an enterprise application and deploying it on a heavy proprietary application server like NetWeaver, whose architecture is just not modern anymore. The bundle concept is unknown to it. Nevertheless still an excellent application server.
Don't forget scalability - using bundles would be much easier to manage dependencies and physical separation and transport.
2. Context-dependant language generator plug-in for Eclipse
There was an amazing demo of a framework which lets you easily define your own language and reserved words for it. After that you can easily create an Eclipse project specific for your new language and even have the editor validate your syntax and semantics!
The presenter Kiril did a great job and capture the audience - he was the winner of the Demo sessions.
3. Rational
The presenter was a guy from Croatia (sorry if I am wrong) and used not 1 but 4 presentation sessions to explain what Rational can and cannot do (actually, I think it can do everything, even prepare you a sandwich...)
So basically Rational is a CASE tool which covers all aspects of software development process:
- requirements engineering
- storing requirements and managing them
- preparing architecture
- design analysis
- bug tracker and connection to various requirements
- track exceptions with real code lines and bugs
- suggest improvements based on an exception
- complex statistics and diagrams which even the presenter was confused to explain
and many more
Believe me, if you know all the features of Rational and can use it productively you are a GOD.
Unfortunately not everybody in the audience appreciated the presenters attempt to cover high percentage of the products capabilities... His voice wasn't as clear as hoped either...
----
All in all I am very confident that I will attend the Eclipse Demo Camp next year and who knows - may be I'll present something of my own...
L.K.
Sunday, June 20, 2010
NetBeans 6.8 ME removal leads to unusable NetBeans
I had installed NetBeans 6.8 the version where all possible java technologies are bundled together.
I had no problems, but I decided to deactivate and uninstall the ME plugins... huge mistake.. The whole NetBeans became an empty shell... with just a few menus to the top and a simple editor... I was greatly surprised.
The good thing is that I installed NetBeans 6.9 and it sniffed my NetBeans 6.8 and imported all projects, copied the configurations and even the plugins... And in just 5 minutes a could continue with my work having all my configurations, no need to configure all my custom changes all over again.
So in just 30 minutes I was surprised twice by the NetBeans - the good thing is that in the end everything is working how it is supposed to be working. :)
I suppose this is something that Еclipse lacks...
//later edit:
- different Eclipse installations can share configuration with the Workspaces
I had no problems, but I decided to deactivate and uninstall the ME plugins... huge mistake.. The whole NetBeans became an empty shell... with just a few menus to the top and a simple editor... I was greatly surprised.
The good thing is that I installed NetBeans 6.9 and it sniffed my NetBeans 6.8 and imported all projects, copied the configurations and even the plugins... And in just 5 minutes a could continue with my work having all my configurations, no need to configure all my custom changes all over again.
So in just 30 minutes I was surprised twice by the NetBeans - the good thing is that in the end everything is working how it is supposed to be working. :)
I suppose this is something that Еclipse lacks...
//later edit:
- different Eclipse installations can share configuration with the Workspaces
Monday, May 24, 2010
JDK 1.6 installation problems
Today's topic is Java Developers' Kit.
I've had a peculiar problem with JDKs. I wanted to install the latest version of JDK 1.6 update 18 at the time, but I also wanted to have JDK 1.5 so that I test my application with different compilers and runtime environments.
However there was some sort of problem with it (the source of it, I am unaware till this day) that caused my Windows unable to detect my successful installation. I checked that on this special site java.com
I could also check it with an applet in a page - it said that I need to install java...
1. First idea - reinstall
I thought that my register was messed-up and ran CCleaner to clean it. That didn't help.
I decided to reinstall it and here's my first surprise:
After the successful uninstall and running CCleaner again (just to be sure), and decided to reinstall the JDK
I've got a very "funny" error message (something like this - I don't remember the correct caption):
"Installer has detected that you have JDK installed. Do you want to repair/reinstall it?"
If you click NO - the installer shuts down.
If you click YES - the following message appears:
"You don't have JDK installed on your machine!"
Holly shit ! Isn't that just a bit contradicting...
Obviously, the algorithm at the beginning isn't the same as the one at the end...
2. Second idea - install older version
OK. I cannot override this incorrect installation. So let's try to downgrade it a bit.
I decided to try JDK 1.6 update 17. When I run it it said:
"You have already installed a higher version of JDK" - installation finished!
Thank you very much, smart installer!
3. Third idea - ask Google
"OK stop trying to be a smart ass. There has to be somebody with the same problem that has a solution!"
was my thought.
Yeah, right... After many hours of searching and "smart solutions", none of them helped me.
I intend not to list them here... just too many and very customized...
One of them seemed promising to me.
Google helped me find a tool and step-by-step solution.
4. Forth idea - clean up registry
I absolutely had no other choice than to try and clean my registry.
Including backing up my registry and using a free tool called "JavaRA" that could help me maintain my system and Java versions and updates very well... well I tried it and it didn't help... I was very disappointed but maybe my expectations were just too great.
5. No idea - desperation
I was quite desperate that my JDK ws not correctly installed. My applets weren't working. Eclipse stopped working at a certain moment. NetBeans - too. I even had to use system restore... a total disaster.
And I just migrated to Windows 7 Pro 64bit version... which seemed nice for user but apparently not for JAVA users... Using Win XP I didn't have such problems (although I think I had a similar problem a few years ago).
...
but I had a workaround!!
6. The workaround - JDK 1.7 unofficial!
Well, I was lucky I accidentally installed JDK1.7 which is still unofficial and doesn't overwrite the latest JDK 1.6. So when I installed and played around with PATH and JAVA_HOME variables and Eclipse and NetBeans configurations, I was able to continue with my Java project development.
But I was still unsatisfied, because this is just a workaround !
I've had a peculiar problem with JDKs. I wanted to install the latest version of JDK 1.6 update 18 at the time, but I also wanted to have JDK 1.5 so that I test my application with different compilers and runtime environments.
However there was some sort of problem with it (the source of it, I am unaware till this day) that caused my Windows unable to detect my successful installation. I checked that on this special site java.com
I could also check it with an applet in a page - it said that I need to install java...
1. First idea - reinstall
I thought that my register was messed-up and ran CCleaner to clean it. That didn't help.
I decided to reinstall it and here's my first surprise:
After the successful uninstall and running CCleaner again (just to be sure), and decided to reinstall the JDK
I've got a very "funny" error message (something like this - I don't remember the correct caption):
"Installer has detected that you have JDK installed. Do you want to repair/reinstall it?"
If you click NO - the installer shuts down.
If you click YES - the following message appears:
"You don't have JDK installed on your machine!"
Holly shit ! Isn't that just a bit contradicting...
Obviously, the algorithm at the beginning isn't the same as the one at the end...
2. Second idea - install older version
OK. I cannot override this incorrect installation. So let's try to downgrade it a bit.
I decided to try JDK 1.6 update 17. When I run it it said:
"You have already installed a higher version of JDK" - installation finished!
Thank you very much, smart installer!
3. Third idea - ask Google
"OK stop trying to be a smart ass. There has to be somebody with the same problem that has a solution!"
was my thought.
Yeah, right... After many hours of searching and "smart solutions", none of them helped me.
I intend not to list them here... just too many and very customized...
One of them seemed promising to me.
Google helped me find a tool and step-by-step solution.
4. Forth idea - clean up registry
I absolutely had no other choice than to try and clean my registry.
Including backing up my registry and using a free tool called "JavaRA" that could help me maintain my system and Java versions and updates very well... well I tried it and it didn't help... I was very disappointed but maybe my expectations were just too great.
5. No idea - desperation
I was quite desperate that my JDK ws not correctly installed. My applets weren't working. Eclipse stopped working at a certain moment. NetBeans - too. I even had to use system restore... a total disaster.
And I just migrated to Windows 7 Pro 64bit version... which seemed nice for user but apparently not for JAVA users... Using Win XP I didn't have such problems (although I think I had a similar problem a few years ago).
...
but I had a workaround!!
6. The workaround - JDK 1.7 unofficial!
Well, I was lucky I accidentally installed JDK1.7 which is still unofficial and doesn't overwrite the latest JDK 1.6. So when I installed and played around with PATH and JAVA_HOME variables and Eclipse and NetBeans configurations, I was able to continue with my Java project development.
But I was still unsatisfied, because this is just a workaround !
A developer must never be satisfied with a mere workaround!
Wednesday, May 19, 2010
NetBeans 6.8 bugs
Today I'll comment my favourite IDE for Java development - NetBeans.
Some may say that I'm a newbie and like less complicated IDE or that "true Java developers" use Eclipse - OK so be it, but I'm working on Eclipse at work and at home I'm using whatever I feel like using and NetBeans is what I like using!
So I've recently found a few bugs while developing a small application.
1. Swing forms editor bug
NetBeans is popular with its very well-made Swing UI editor and I agree with common understandings. UI forms are easy to use, can be configured in lots of ways (some of which I haven't tried yet), but satisfies my needs completely. It generates some code and locks it , so that future UI replacement/movements are still consistent with the rest of the class you are managing. Easy event handling methods and so on...
But I've had a few places I wanted to manipulate and configure the initialization of the components. NetBeans automatically creates a constructor with "init();" method call in it , but my case required to modify this init() method.
So you can click on the JComponent and click "Customize code" , which lets you modify the constructor called but not the declaration! I found this very restrictive and tried to trick NetBeans.
I had to change the place of a class from package "a" to package "b", but if I cannot change the declaration, I'm stuck. So I decided to use REFACTOR rename on the package of the problematic class. And it worked! ...
at first...
I refactored the name of the package and no problem in the UI created code.
But if you try to move 1 pixel of the UI form , it regenerates again the locked code and refreshes the metainf. xml in the netbeans project and my IDE shows an error of non-existing class/package...
I'm going to report this and get it fixed in NetBeans 6.9.
2. Main class in built .jar is missing
The next major bug I've found is already reported. I even reached the helpful guys in www.stackoverflow.com
You can find my question here -> Main class in NetBeans bug
I'll rewrite the short description here:
You create a Java project in NetBeans 6.8 or 6.9 and build it to create a .jar file.
Even if you have set in the project settings which class contains the main() method to be executed, the build omits this configuration in the meta-inf/manifest file after build and so the .jar is not executable.
This is easily fixed by :
- creating a metainf.mf file in root of your project
- the file contains something like
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 16.3-b01 (Sun Microsystems Inc.)
Main-Class: com.example.MainClass
Class-Path: lib/lib1.jar lib/lib2.jar
- editing the nbproject/project.properties file
- add manifest.file=manifest.mf
- save and rebuild
This solved my problem and thanks a lot to the NetBeans and stackoverflow society so quickly.
L.K.
Some may say that I'm a newbie and like less complicated IDE or that "true Java developers" use Eclipse - OK so be it, but I'm working on Eclipse at work and at home I'm using whatever I feel like using and NetBeans is what I like using!
So I've recently found a few bugs while developing a small application.
1. Swing forms editor bug
NetBeans is popular with its very well-made Swing UI editor and I agree with common understandings. UI forms are easy to use, can be configured in lots of ways (some of which I haven't tried yet), but satisfies my needs completely. It generates some code and locks it , so that future UI replacement/movements are still consistent with the rest of the class you are managing. Easy event handling methods and so on...
But I've had a few places I wanted to manipulate and configure the initialization of the components. NetBeans automatically creates a constructor with "init();" method call in it , but my case required to modify this init() method.
So you can click on the JComponent and click "Customize code" , which lets you modify the constructor called but not the declaration! I found this very restrictive and tried to trick NetBeans.
I had to change the place of a class from package "a" to package "b", but if I cannot change the declaration, I'm stuck. So I decided to use REFACTOR rename on the package of the problematic class. And it worked! ...
at first...
I refactored the name of the package and no problem in the UI created code.
But if you try to move 1 pixel of the UI form , it regenerates again the locked code and refreshes the metainf. xml in the netbeans project and my IDE shows an error of non-existing class/package...
I'm going to report this and get it fixed in NetBeans 6.9.
2. Main class in built .jar is missing
The next major bug I've found is already reported. I even reached the helpful guys in www.stackoverflow.com
You can find my question here -> Main class in NetBeans bug
I'll rewrite the short description here:
You create a Java project in NetBeans 6.8 or 6.9 and build it to create a .jar file.
Even if you have set in the project settings which class contains the main() method to be executed, the build omits this configuration in the meta-inf/manifest file after build and so the .jar is not executable.
This is easily fixed by :
- creating a metainf.mf file in root of your project
- the file contains something like
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 16.3-b01 (Sun Microsystems Inc.)
Main-Class: com.example.MainClass
Class-Path: lib/lib1.jar lib/lib2.jar
- editing the nbproject/project.properties file
- add manifest.file=manifest.mf
- save and rebuild
This solved my problem and thanks a lot to the NetBeans and stackoverflow society so quickly.
L.K.
Wednesday, May 12, 2010
Debugging Eclipse
Today I had the chance to debug some functionality in the Eclipse IDE, or to be more precise the SAP NetWeaver Developer Studio customized version of Eclipse.
The main thing about debugging is to setup your environment the right way.
There is configuration.ini file in the main directory of your IDE. Inserting specific parameters allows the NetWeaver DS to be started in debug mode and on specified port.
Then you need to start a debug session as a "Remote application" on 'localhost:port' and you are good to go.
I managed to do that but I lost some time figuring this thing out :
- better make a copy of your IDE and not debug your IDE with the same one.
What I mean is that you can open 2 times the same IDE and debug one of them with the other but here's the tricky part. If you want to make update to a file in the IDE you want to debug, you will have to shut down both instances and start them up again. And lets suppose you have to change not 1 file but a few files, and not just 1 time, but a few times... and then you have wasted your time.
Personal advice - make a separate copy of your IDE and use it for DEBUG and leave your main IDE untouched.
Other than that, there is nothing special about it.
L.K.
The main thing about debugging is to setup your environment the right way.
There is configuration.ini file in the main directory of your IDE. Inserting specific parameters allows the NetWeaver DS to be started in debug mode and on specified port.
Then you need to start a debug session as a "Remote application" on 'localhost:port' and you are good to go.
I managed to do that but I lost some time figuring this thing out :
- better make a copy of your IDE and not debug your IDE with the same one.
What I mean is that you can open 2 times the same IDE and debug one of them with the other but here's the tricky part. If you want to make update to a file in the IDE you want to debug, you will have to shut down both instances and start them up again. And lets suppose you have to change not 1 file but a few files, and not just 1 time, but a few times... and then you have wasted your time.
Personal advice - make a separate copy of your IDE and use it for DEBUG and leave your main IDE untouched.
Other than that, there is nothing special about it.
L.K.
Just a reminder for my future posts
I'll write about the following topics in no particular order, unless somebody says explicitly that they are interested in a topic and I'll post it ASAP.
I'd like to remind myself to document my thoughts regarding these topics:
These topics will follow:
I'd like to remind myself to document my thoughts regarding these topics:
These topics will follow:
JDK 7 new featureswhat I likewhat I don't likeJDK 1.6 installation problemshints how to solve the problems- Sony PRS-600 Touch - my brand new reader (and all the fuss regarding getting it)
- review
- some hints, tips and tricks
- problems
- conversion tools
Windows 7connecting to networkcontrol panel (Back) button navigationsome bugs of my Dell Inspiron LaptopDVDstrange noiseEclipse debuggingNetBeans 6.8 bugsswing editor bugs - needs to be reportedmain class problemLaptop battery preservation tipsbecause what I have done so far has proven me right - thoughts from experience- Internet Browsers
- Opera thoughts
- Chrome
- Firefox
- IE
- Google Chrome OS
- Android
Skype time stamp bugHDD partitioning problemshow not to make your data inconsistent because of pure mistake or lack of knowledgeTest-Driven Development
L.K.
Subscribe to:
Posts (Atom)