Home » headline, maven, screencast

Apache Maven: Creating a Basic Web Application (Screencast)

19 May 2009 7 Comments

[flashvideo file=”/content/uploads/2009/05/creating-basic-web-app.mp4″ /]

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.

7 Comments »

  • Dan Hinojosa said:

    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:~$

  • Jamae Javid (author) said:

    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.

  • Dietrich said:

    Or use the mvn -U option when running the plugin.

  • Alfa said:

    Thanks for the video creating absic web guide.

  • Deter said:

    Hi Jamae Javid,

    I wanted to learn about maven and my friend fwd me this link.But, I am not able to watch the screencast..

    Could you please upload it again,incase you removed it..

    Thanks
    Deter

  • Nick said:

    Stumbled upon this nice screencast by chance. Just wanted to express my gratitude for this well done tutorial. It’s easy to follow, you explain everything that happens and your narration is easy to understand and follow. I wish there would be more tutorials like this out there …

  • Lakmal said:

    Hi Javid,

    Thanks a lot for the tutorials…!
    Very much useful…

    Thanks.
    Lakmal