Apache Maven: Creating a Basic Web Application (Screencast)
19 May 2009
67,760 Views
3 Comments
Get the Flash Player to see this player.
Note: Click on the full-screen button in the player when watching the screencast.
In this screencast on Apache Maven, you’ll learn how to gernate a basic web application and run it inside of the Tomcat web container. You’ll explore the file structure and pom file for a web application, learn how to import the Servlet API into your project, and how to add resource files to your source code.
You can find all of my screencasts on my Screencasts page which is linked off the top-level navigation for the site.









I never really used maven seriously. But I tried it and came with the following issues:
danno@danno-laptop:~$ mvn -version
Apache Maven 2.1.0 (r755702; 2009-03-18 13:10:27-0600)
Java version: 1.6.0_11
Java home: /home/danno/java/jdk1.6.0_11/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.28-11-generic" arch: "i386" Family: "unix"
danno@danno-laptop:~$ mvn archetype:generate
[INFO] Scanning for projects…
[INFO] Searching repository for plugin with prefix: ‘archetype’.
[INFO] ————————————————————————
[ERROR] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Required goal not found: archetype:generate in org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7
[INFO] ————————————————————————
[INFO] For more information, run Maven with the -e switch
[INFO] ————————————————————————
[INFO] Total time: < 1 second
[INFO] Finished at: Tue May 19 14:32:20 MDT 2009
[INFO] Final Memory: 2M/40M
[INFO] ————————————————————————
danno@danno-laptop:~$ mvn -e archetype:generate
+ Error stacktraces are turned on.
[INFO] Scanning for projects…
[INFO] Searching repository for plugin with prefix: ‘archetype’.
[INFO] ————————————————————————
[ERROR] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Required goal not found: archetype:generate in org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7
[INFO] ————————————————————————
[INFO] Trace
org.apache.maven.BuildFailureException: Required goal not found: archetype:generate in org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1802)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:446)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:176)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ————————————————————————
[INFO] Total time: < 1 second
[INFO] Finished at: Tue May 19 14:32:31 MDT 2009
[INFO] Final Memory: 2M/40M
[INFO] ————————————————————————
danno@danno-laptop:~$
Hmm, that seems like the wrong version of the archetype plugin. I don’t know how that happened. I have 2.0-alpha-4, while you have 1.0-alpha-7. Look and see what you have under the following directory:
~\.m2\repository\org\apache\maven\archetype\archetype-common\
Try wiping out that directory and see what happens. If not, try wiping out your entire local repository and let it download everything from scratch.
If that doesn’t work, you should probably post the the Apache forums (or on JavaRanch). I’ll still look at it, but its a better place to get support since there will be more eyes on it, and someone may have encountered this before.
Or use the mvn -U option when running the plugin.
Leave your response!
Follow me on Twitter
Pages
Archives
Categories
Blogroll
Useful Websites
Tags
agile annotations apache build copyright design email etiquette farsi fit java javaranch jboss jbossinaction just-in-time language maven music myspace performance persian planning process psychology quality recruiting refactoring response time scope screencast small teams smells stdd taxonomy tdd technical debt technology testing throughput universal velocity waterfall wiki xml xpRecent Posts
Most Commented
Most Viewed
Popular Posts