Search This Blog

Friday, May 7, 2010

maven setting up eclipse and on windows errors and using it errors

maven is kind of project management tool and that you will find everywhere
if you use eclipse generally you can keep the jars in classpath but using maven- creates a common repository on your local drive to keep all those jars so that you can use them easily in all the project and common to all project and for each project there is a pom defined which contain the version name and ids for jars
One thing more maven can also create a project in a proper way a hierarchy similar to eclipse creates a dynamic project or static project
point is if you are using eclipse you dont need everything to do just download a plugin and install it in eclipse just go on help tab on top in eclipse and go to install new software and add http://m2eclipse.sonatype.org/sites/m2e .There it downloads a plugin for maven to eclipse m2e now to configure it properly download maven the console version http://maven.apache.org/download.html the zip file or any other and just extract it in C: drive
to step on command line just have to add some environment variables
and for this you should have already installed the java development kit
here are the environment variables to be added
add all of them to work for both eclipse and from console
add them in windows by going to MYcomputer right click and advanced >environment variables >just in system variable click add
CLASSPATH
C:\Program Files\Java\jre6\lib; for jre path it can differ just in classpath point it to jre lib and also add a colon in the end

2-JAVA_HOME
C:\Program Files\Java\jdk1.6.0_19
no colon in the end in JAVA_HOME this is added so that maven can find tools.jar so its main requirement for maven
3-MAVEN_HOME
C:\tools\apache-maven-2.2.1
this is for maven running from console
4-PATH
C:\Program Files\Java\jdk1.6.0_19\bin;C:\apache-maven-2.2.1\bin;
just add these and MIND THE FOLDER apache-maven is the one where you have the console for the maven extracted after downloading from the website

Now just type on cmd mvn
if it works
and show thats good
test mvn -version
also test for java on cmd
type java

if it working than your maven is working from command prompt
now for eclipse there can be error like when building a project that
maven can 't find jre \tools.jar
so just go in eclipse
window>preferences>java>Installed jre and then add if no virtual machine added mean your eclipse should point to jdk so just check if its already added edit it and point it your jdk not the jre folder because maven looks for tools.jar which is in jdk not jre6


Now if you had configured everything is working fine but sometimes some dependency will be missing in your project or missing artifact than to installed separate jar
mvn install:install-file -DgroupId=groupid -DartifactId=artifactid -Dversion=version -Dpackaging=jar -Dfile="path to the jar on your local machine in double quotes " -DgeneratePom=true
this command on cmd and path for jar local machine should be with forward slash and in quotes


if
Invalid task 'build': you must specify a valid lifecycle phase, or a goa
e format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal

this error comes it must be a problem with your maven version or just

remeber to add
-DgeneratePom=true
when you are adding a jar on local repository and also each time first clean maven by mvn clean
if still there is problem in missing any jar
just go in you repository location and delete the folder created wiith your related jar


to run from eclipse you need to add a file in m2 C:\Documents and Settings\(your account)\.m2 here settings.xml

copy this in settings.xml

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">












just this and save
finally it works if not you can comment to ask me

Thursday, April 22, 2010

how to start with java development

Several people, who have not know me before, asked me What books did you read.
Learning and reading books is a must but not enough.
What is the most important is the personality attitude, pation and how you think, why you are doing coding this way in this area. Once you try to realize you get to be best very fast, you fail as fast as you have started.

In my humble personal opinion, it does not really matter how many certificates you have earned, how many books you have read, but it matters how you think, the manner of you programming and architectural style, how you realize that the code you type is sentences and language that all other people must understand. S/w is the state of art.

well, the Java technologies area is so huge that we can concern only some parts in order to handle very deep hands on experiences.
The Java technologies are splited in to subsets. I recognize the following ones: Java SE, EE, J2ME, Java Runtime, Java Media Framework, JavaFX, ...
It depends on which of them are requested by your business.

What I always recommend to all programmers is to know you domain very well. The s/w design is then determined by the programming language used in your project.
Thus first of all, read the following specifications of s/w standars in order as specified:
+ The Java Virtual Machine - Second Edition.
+ The Java Programming Language - Third Edition
+ Java Community Links, and Programmers Guides on SUN webpages.
+ Understand you virtual machine road map, configurations and garbage collector algorithm. Do not hesitate contact the vendor of SDK. If your SDK version is lower than 1.5, be aware of memory model implemented by the vendor.
+ Read JSR specs under your JRE.

I think Ronald wants to hear a story. Briefly, I am Msc but not any s/w scientist. I hated all other than assembler and Matlab programming till my University. I was a radio ham since 9. I understood all from atoms up to transistors and ICs, and later on processors, especially ADI DSP. At the University I was leading 50% of team and studying high level programming languages and took courses. Started my commercial job as a Java programmer and s/w integrator at IPTV project at the Siemens. So the growth was fast, very fast to me, but I was involved in IPTV team together with developers, external s/w parties, made daily consultings with Entone and Sciatel, managers, integrators and admins. There I understood how important it is to know what and how all parts of project are performing if you want to be a good programmer. Because the code "goes through all of these hands" and even more.

Nowadays focusing on OSGi + Maven, Java Cryptography, Java Security, NIO, own Maven plugin of jar signer, building own servlet with authorization.
The reason was to develop open IPTV client in my private project, and therefore still was not happy because someting was missing: architecture knowledge, domain design model knowledge, systems security knowledge, Agile Methods gab. I was not happy with often refactoring.

Later it would lead me to administrations and teaching students at the University in my 50's when no entrepreneur wants me :)))