Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docpublic:concepts:java:maven [2014/12/20 21:53]
procacci@tem-tsp.eu [ref]
docpublic:concepts:java:maven [2016/04/26 13:15] (current)
procacci@tem-tsp.eu [reprise sous debien generate]
Line 5: Line 5:
   * http://dcabasson.developpez.com/articles/java/maven/introduction-maven2/   * http://dcabasson.developpez.com/articles/java/maven/introduction-maven2/
   * http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html   * http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
 +  * http://www.tutorialspoint.com/servlets/servlets-first-example.htm
  
 TP  http://dcabasson.developpez.com/articles/java/maven/introduction-maven2/ TP  http://dcabasson.developpez.com/articles/java/maven/introduction-maven2/
 +
 +==== create ====
  
 9. Création d'un nouveau projet avec le plug-in archetype 9. Création d'un nouveau projet avec le plug-in archetype
Line 53: Line 56:
 [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------
 </code> </code>
 +
 +==== reprise sous debian generate ====
 +
 +apres execution de ce create sous centos, une reprise de l'arborescence sous debian donne ceci au "create" 
 +
 +<code>
 +$ mvn -e archetype:create -DgroupId=com.javaworld.hotels -DartifactId=HotelDatabase -Dpackagename=com.javaworld.hotels
 ++ Error stacktraces are turned on.
 +[INFO] Scanning for projects...
 +[INFO] Reactor build order: 
 +[INFO]   Hotel Database tutorial application
 +[INFO]   Hotel webapp tutorial application
 +[INFO]   Unnamed - com.javaworld.hotels:Hotel:pom:1.0-SNAPSHOT
 +[INFO] Searching repository for plugin with prefix: 'archetype'.
 +[INFO] ------------------------------------------------------------------------
 +[INFO] Building Unnamed - com.javaworld.hotels:Hotel:pom:1.0-SNAPSHOT
 +[INFO]    task-segment: [archetype:create] (aggregator-style)
 +[INFO] ------------------------------------------------------------------------
 +[INFO] ------------------------------------------------------------------------
 +[ERROR] BUILD ERROR
 +[INFO] ------------------------------------------------------------------------
 +[INFO] Failed to configure plugin parameters for: org.apache.maven.plugins:maven-archetype-plugin:2.4
 +...
 +Cause: Cannot assign configuration entry 'pomRemoteRepositories' to 'interface java.util.List' from 'null', which is of type class java.lang.String
 +[INFO] ------------------------------------------------------------------------
 +[INFO] Trace
 +org.apache.maven.lifecycle.LifecycleExecutionException: Error configuring: org.apache.maven.plugins:maven-archetype-plugin. Reason: Unable to parse the created DOM for plugin configuration
 +</code>
 +
 +solution : faire un generate plutot qu'un create qui est devenu deprecated en maven 3 
 +
 +http://stackoverflow.com/questions/29147329/unable-to-create-a-new-maven-hello-world-project
 +
 +esuite si pb de ce type
 +
 +<code>
 +$ mvn -e archetype:generate -DgroupId=com.javaworld.hotels -DartifactId=HotelDatabase -Dpackagename=com.javaworld.hotels 
 +....
 +[ERROR] BUILD FAILURE
 +[INFO] ------------------------------------------------------------------------
 +[INFO] : org.apache.maven.archetype.old.ArchetypeTemplateProcessingException: Directory HotelDatabase already exists - please run from a clean directory
 +Directory HotelDatabase already exists - please run from a clean directory
 +[INFO] ------------------------------------------------------------------------
 +[INFO] Trace
 +org.apache.maven.BuildFailureException: Directory HotelDatabase already exists - please run from a clean directory
 +
 +</code>
 +
 +c'est qu'on est pas dans le bon niveau d'arborescence
 +il faut remonter d'un cran 
 +
 +<code>
 +$ cd ..
 +$ ls
 +application  application.tgz
 +$ mvn archetype:generate -DgroupId=com.javaworld.hotels -DartifactId=HotelDatabase -Dpackagename=com.javaworld.hotels
 +[INFO] Scanning for projects...
 +[INFO] Searching repository for plugin with prefix: 'archetype'.
 +...
 +[INFO] project created from Old (1.x) Archetype in dir: /home/xib/HotelDatabase
 +[INFO] ------------------------------------------------------------------------
 +[INFO] BUILD SUCCESSFUL
 +</code>
 +
 +==== clean ====
 +
 +<code>
 +$ mvn clean
 +[INFO] Scanning for projects...
 +[INFO] Reactor build order: 
 +[INFO]   Hotel Database tutorial application
 +[INFO]   Hotel webapp tutorial application
 +[INFO]   Unnamed - com.javaworld.hotels:Hotel:pom:1.0-SNAPSHOT
 +[INFO] ------------------------------------------------------------------------
 +[INFO] Building Hotel Database tutorial application
 +[INFO]    task-segment: [clean]
 +[INFO] ------------------------------------------------------------------------
 +Downloading: https://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
 +3K downloaded  (maven-clean-plugin-2.5.pom)
 +</code>
 +
  
 Vous avez maintenant une structure de projet Maven 2 toute neuve. Allez dans le répertoire HotelDatabase pour continuer ce tutoriel. Vous avez maintenant une structure de projet Maven 2 toute neuve. Allez dans le répertoire HotelDatabase pour continuer ce tutoriel.
Line 367: Line 451:
 [INFO] Final Memory: 8M/20M [INFO] Final Memory: 8M/20M
 [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------
 +</code>
 +
 +
 +contenu du war 
 +
 +<code>
 +[disi@cas4 HotelWebapp]$ jar tvf ./target/HotelWebapp.war
 +     0 Sat Dec 20 22:44:04 CET 2014 META-INF/
 +   123 Sat Dec 20 22:44:02 CET 2014 META-INF/MANIFEST.MF
 +     0 Sat Dec 20 22:44:02 CET 2014 WEB-INF/
 +     0 Sat Dec 20 22:44:02 CET 2014 WEB-INF/classes/
 +     0 Sat Dec 20 22:44:02 CET 2014 WEB-INF/lib/
 +   215 Sat Dec 20 22:37:44 CET 2014 WEB-INF/web.xml
 +  4153 Tue Dec 16 18:04:22 CET 2014 WEB-INF/lib/HotelDatabase-1.0-SNAPSHOT.jar
 +  1571 Sat Dec 20 22:41:22 CET 2014 index.jsp
 +     0 Sat Dec 20 22:44:04 CET 2014 META-INF/maven/
 +     0 Sat Dec 20 22:44:04 CET 2014 META-INF/maven/com.javaworld.hotels/
 +     0 Sat Dec 20 22:44:04 CET 2014 META-INF/maven/com.javaworld.hotels/HotelWebapp/
 +   892 Sat Dec 20 22:43:54 CET 2014 META-INF/maven/com.javaworld.hotels/HotelWebapp/pom.xml
 +   123 Sat Dec 20 22:44:02 CET 2014 META-INF/maven/com.javaworld.hotels/HotelWebapp/pom.properties
 +</code>
 +
 +
 +deployement dynamique du war dans tomcat 
 +
 +<code>
 +[root@cas4 ~]# ls -l /var/lib/tomcat/webapps/
 +total 0
 +drwxr-xr-x 5 root tomcat 82 10 déc.  16:25 host-manager
 +drwxr-xr-x 5 root tomcat 97 10 déc.  16:25 manager
 +[root@cas4 ~]# cp /home/disi/HotelWebapp/target/HotelWebapp.war /var/lib/tomcat/webapps/
 +[root@cas4 ~]# ls -l /var/lib/tomcat/webapps/
 +total 8
 +drwxr-xr-x 5 root   tomcat   82 10 déc.  16:25 host-manager
 +drwxr-xr-x 4 tomcat tomcat   51 20 déc.  23:06 HotelWebapp
 +-rw-r--r-- 1 root   root   5843 20 déc.  23:05 HotelWebapp.war
 +drwxr-xr-x 5 root   tomcat   97 10 déc.  16:25 manager
 +
 +</code>
 +
 +log tomcat au meme moment 
 +
 +<code>
 +[root@cas4 ~]# tail -f /var/log/tomcat/catalina.out
 +
 +déc. 20, 2014 11:06:01 PM org.apache.catalina.startup.HostConfig deployWAR
 +INFOS: Déploiement de l'archive /var/lib/tomcat/webapps/HotelWebapp.war de l'application web
 +
 +</code>
 +
 +http://cas4.itsudparis.eu:8080/HotelWebapp/
 +
 +<code>
 +Application Tutoriel pour la base de données des hotels
 +
 +Choisissez une destination
 +
 +Merci de choisir une ville :  Chercher
 +Hôtels disponibles à Londres
 +
 +Nom Adresse Ville Catégorie
 +Hotel Hilton Trafalgar Square Londres 4 étoiles
 +Hotel Ibis The City Londres 3 étoiles
 </code> </code>
  
  
docpublic/concepts/java/maven.1419112405.txt.gz · Last modified: 2014/12/20 21:53 by procacci@tem-tsp.eu
[unknown link type]Back to top
CC Attribution-Noncommercial-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0