wiki:TutorialMaven

Version 6 (modified by vegasm, 9 years ago) (diff)

--

Thredds development with Eclipse

We have to follow some steps to develop Thredds project with Eclipse IDE and Java Environment. Thredds is a project that uses Maven so we will configurate Maven in our pc too.

How to configurate Java environment in your pc:

1- Download JDK (Java Development Kit) latest release 1.7, Maven and Eclipse

JDK: http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html
MAVEN: http://apache.rediris.es/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.zip
Eclipse Juno for Java EE Developers:  http://www.eclipse.org/downloads/ 

JDK is necessary to install and the others only unzip the folders where you prefer.

2- Configuration of Java Environtment variables in our system

PATH = C:\Program Files\Java\jdk1.7.0\bin (Necessary to exec javac command)
JAVA_HOME = C:\Program Files\Java\jdk1.7.0

3- Configuration of Apache Maven Environment variables

MAVEN_HOME = C:\Program Files\apache-maven-3.0.4
PATH = C:\Program Files\Java\jdk1.7.0\bin;%MAVEN_HOME%\bin; (Necessary to exec mvn command)

4- Check if your configuration is OK

Go to Start menu => execute => type cmd Type mvn-version and you should see something like this:

Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: C:\Program Files\apache-maven-3.0.4\bin\..
Java version: 1.7.0, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0\jre
Default locale: es_ES, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

How to download thredds project and compile it with Maven

Download thredds from here by clicking Zip button and unzip wherever you want: https://github.com/Unidata/thredds

Then is time to test out maven installation. Open cmd and go to the main folder project. Execute mvn install and you should see something like this:

[INFO] Parent THREDDS and CDM modules .................... SUCCESS [0.413s]
[INFO] udunits ........................................... SUCCESS [1.731s]
[INFO] NetCDF-Java Library ............................... SUCCESS [7.892s]
[INFO] BUFR IOSP ......................................... SUCCESS [2.338s]
[INFO] GRIB IOSP and Feature Collection .................. SUCCESS [4.176s]
[INFO] OPeNDAP ........................................... SUCCESS [1.208s]
[INFO] DAP Test Server (DTS) webapp ...................... SUCCESS [5.381s]
[INFO] VisAD-based IOSPs ................................. SUCCESS [10.800s]
[INFO] UI Module ......................................... SUCCESS [26.342s]
[INFO] THREDDS Data Server (TDS) ......................... SUCCESS [14.164s]
[INFO] THREDDS Data Manager (TDM) ........................ SUCCESS [5.220s]
[INFO] WMO tables webapp ................................. SUCCESS [5.628s]
[INFO] CDM validator webapp .............................. SUCCESS [16.842s]
[INFO] Test CDM (upc/share - Unidata only) ............... SUCCESS [1.050s]
[INFO] Test Integration .................................. SUCCESS [2.224s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:45.999s
[INFO] Finished at: Wed Dec 05 13:04:12 CET 2012
[INFO] Final Memory: 31M/448M
[INFO] ------------------------------------------------------------------------

How to integrate Maven in Eclipse and import Thredds project

Maven integration

First of all download m2eclipse plugin. Go to Help > Install > New software

In work with you have to paste this url: http://download.eclipse.org/technology/m2e/releases

Click on add and type the name (Maven it could be perfect)

Check on Maven Integration for Eclipse and follow the steps

Restart Eclipse

Import thredds project

Go to File > Import > Maven > Check out Maven Projects from SCM

To download thredds project from remote server, m2eclipse needs git SCM Connector. So click on m2e Marketplace and install git connector. You will see an installation wizard. After the installation finishes, select git from SCM URL, paste the following URL: https://github.com/Unidata/thredds.git and click on finish.

A Checking out and Building process will be started. It could take several minutes so be patient.

How to fix opendap bug

Eclipse Project Explorer contains thredds-parent project and all its subprojects. Opendap subproject has a bug in some java classes caused by an old uri declaration on package sentence. Go to each class, click on error sentence and solve the problem by clicking "Change package declaration to...". In GuiTest?.java remove the two unused imports.

Configure and deploy TDS over Apache Tomcat 6 in Eclipse

Now we will focus on TDS subproject. TDS is a web project that contains J2EE web project structure but Eclipse doesn't interpret it as a web project. It's neccesary to add web project facet. So right click on tds subproject > Properties >Project facets > Convert to faceted form... > Check Dynamic web module > Right click on Dynamic Web Module > Change version > 2.5 > Apply > OK

Delete WebContent? empty structure. It was created by Dynamic web module facet.

How to fix tds bugs

1- newExamples.xml: add an space on line 118 col 44 2- UnidataDD2MI.xsl : change version 1.1 to 2.0 on line 2 col 26 3- wms folder needs taglib folder so you can copy it.

Change Context root

Project properties > Web Project Settings. Replace tds for thredds Apply and OK.

Change Deployment Assembly

  1. Project properties > Deployment Assembly

Add.. > Folder > /src/main/webapp

  1. Remove /WebContent? source
  1. Go to Java Build path > Order and Export and check on Maven Dependencies. Then click on add > Java Build Path Entries > Maven dependencies
  1. Rebuild project

Now the project is prepared to deploy

Dirección subversion del proyecto de ejemplo: https://www.meteo.unican.es/svn/repos/documentos/trunk/software