Maven – How to create a Java web application project

In this tutorial, we will show you how to use Maven to manage a Java web project. At the end, we will create a Spring MVC web application, display a current date on a JSP page.

Technologies used :

  1. Maven 3.5.3
  2. JDK 8
  3. Spring 5.1.0.RELEASE
  4. JUnit 5
  5. Logback 1.2.3
  6. Jetty 9.4.x or Tomcat 8.5

1. Create a web project from Maven Template

Create a web project from Maven template maven-archetype-webapp


mvn archetype:generate 
	-DgroupId={project-packaging}
	-DartifactId={project-name}
	-DarchetypeArtifactId={maven-template} 
	-DinteractiveMode=false

For example,


D:\>mvn archetype:generate -DgroupId=com.mkyong.web -DartifactId=java-web-project -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.0.1:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.0.1:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.0.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-webapp:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: basedir, Value: D:\
[INFO] Parameter: package, Value: com.mkyong.web
[INFO] Parameter: groupId, Value: com.mkyong.web
[INFO] Parameter: artifactId, Value: java-web-project
[INFO] Parameter: packageName, Value: com.mkyong.web
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: D:\java-web-project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.509 s
[INFO] Finished at: 2018-10-04T15:25:16+08:00
[INFO] ------------------------------------------------------------------------
Note
Actually, this is optional to generate a web project from a Maven web template. You can always generate those folders with the classic mkdir command manually.

2. Maven Template

2.1 The following project directory structure will be created.

P.S Above figure is captured from IntelliJ IDEA, just ignore those IDE folders like .idea and java-web-project.iml

2.2 Review the generated pom.xml.

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" 
	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">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mkyong.web</groupId>
  <artifactId>java-web-project</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>java-web-project Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>java-web-project</finalName>
  </build>
</project>

P.S The generated files are not much value, we will update all of them later. First, delete the web.xml, we don’t need this.

3. Update POM

3.1 Update the pom.xml file, add dependencies for Spring MVC for web framework, JUnit for unit test, Jetty server to test the web project, and also some Maven configuration.

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
         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">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mkyong.web</groupId>
    <artifactId>java-web-project</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>java-web-project Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <properties>
        <!-- https://maven.apache.org/general.html#encoding-warning -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <spring.version>5.1.0.RELEASE</spring.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <!-- logging , spring 5 no more bridge, thanks spring-jcl -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.2.3</version>
        </dependency>

        <!-- junit 5, unit test -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.3.1</version>
            <scope>test</scope>
        </dependency>

        <!-- unit test -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>

        <!-- for web servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>

        <!-- Some containers like Tomcat don't have jstl library -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>
    <build>
        <finalName>java-web-project</finalName>
        <plugins>
            <!-- http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html -->
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.4.12.v20180830</version>
            </plugin>

            <!-- Default is too old, update to latest to run the latest Spring 5 + jUnit 5 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.0</version>
            </plugin>

            <!-- Default 2.2 is too old, update to latest -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.2</version>
            </plugin>

        </plugins>
    </build>

</project>

3.2 Display the project dependencies.


D:\> mvn dependency:tree

...
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ java-web-project ---
[INFO] com.mkyong.web:java-web-project:war:1.0-SNAPSHOT
[INFO] +- org.springframework:spring-webmvc:jar:5.1.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:5.1.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:5.1.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:5.1.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:5.1.0.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.1.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-expression:jar:5.1.0.RELEASE:compile
[INFO] |  \- org.springframework:spring-web:jar:5.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:5.1.0.RELEASE:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  +- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.3.1:test
[INFO] |  +- org.apiguardian:apiguardian-api:jar:1.0.0:test
[INFO] |  +- org.junit.platform:junit-platform-engine:jar:1.3.1:test
[INFO] |  |  +- org.junit.platform:junit-platform-commons:jar:1.3.1:test
[INFO] |  |  \- org.opentest4j:opentest4j:jar:1.1.1:test
[INFO] |  \- org.junit.jupiter:junit-jupiter-api:jar:5.3.1:test
[INFO] +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] \- javax.servlet:jstl:jar:1.2:provided
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.931 s
[INFO] Finished at: 2018-10-08T15:55:08+08:00
[INFO] ------------------------------------------------------------------------

4. Spring MVC + JSP + LogBack

4.1 Create a few files to bootstrap Spring MVC web project.

SpringConfig.java

package com.mkyong.web.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;

@EnableWebMvc
@Configuration
@ComponentScan({"com.mkyong.web"})
public class SpringConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/resources/**")
                .addResourceLocations("/resources/");
    }

    @Bean
    public InternalResourceViewResolver viewResolver() {
        InternalResourceViewResolver viewResolver
                = new InternalResourceViewResolver();
        viewResolver.setViewClass(JstlView.class);
        viewResolver.setPrefix("/WEB-INF/views/");
        viewResolver.setSuffix(".jsp");
        return viewResolver;
    }
}
WebInitializer.java

package com.mkyong.web;

import com.mkyong.web.config.SpringConfig;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    @Override
    protected Class<?>[] getRootConfigClasses() {
        return null;
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{SpringConfig.class};
    }

    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }

}
WelcomeController.java

package com.mkyong.web.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Date;

@Controller
public class WelcomeController {

    private final Logger logger = LoggerFactory.getLogger(WelcomeController.class);

    @GetMapping("/")
    public String index(Model model) {
        logger.debug("Welcome to mkyong.com...");
        model.addAttribute("msg", getMessage());
        model.addAttribute("today", new Date());
        return "index";

    }

    private String getMessage() {
        return "Hello World";
    }

}

4.2 Move the index.jsp file into the WEB-INF folder, and update it

index.jsp

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<body>
<h1>${msg}</h1>
<h2>Today is <fmt:formatDate value="${today}" pattern="yyy-MM-dd" /></h2>
</body>
</html>

4.3 Logs to console.

logbacl.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <layout class="ch.qos.logback.classic.PatternLayout">

            <Pattern>
                %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
            </Pattern>

        </layout>
    </appender>

    <logger name="com.mkyong.web" level="debug"
            additivity="false">
        <appender-ref ref="STDOUT"/>
    </logger>

    <root level="error">
        <appender-ref ref="STDOUT"/>
    </root>

</configuration>

5. Unit Test

A simple Spring MVC 5 + JUnit 5 example.

TestWelcome.java

package com.mkyong.web;

import com.mkyong.web.config.SpringConfig;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

@SpringJUnitWebConfig(SpringConfig.class)
public class TestWelcome {

    private MockMvc mockMvc;

    @Autowired
    private WebApplicationContext webAppContext;

    @BeforeEach
    public void setup() {
        mockMvc = MockMvcBuilders.webAppContextSetup(webAppContext).build();
    }

    @Test
    public void testWelcome() throws Exception {

        this.mockMvc.perform(
                get("/"))
                .andDo(print())
                .andExpect(status().isOk())
                .andExpect(view().name("index"))
                .andExpect(forwardedUrl("/WEB-INF/views/index.jsp"))
                .andExpect(model().attribute("msg", "Hello World"));
    }

}

6. Directory Structure

Review the final files and directory structure.

Read this Maven Standard Directory Layout.

7. Demo

7.1 Test the web project with Jetty web server – mvn jetty:run


D:\> mvn jetty:run

[INFO] webAppSourceDirectory not set. Trying src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] nonBlocking:false
[INFO] Classes = D:\java-web-project\target\classes
[INFO] Configuring Jetty for project: java-web-project Maven Webapp
[INFO] Logging initialized @4821ms to org.eclipse.jetty.util.log.Slf4jLog
[INFO] Context path = /
[INFO] Tmp directory = D:\java-web-project\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = null
[INFO] Webapp directory = D:\java-web-project\src\main\webapp
[INFO] jetty-9.4.12.v20180830; built: 2018-08-30T13:59:14.071Z; git: 27208684755d94a92186989f695db2d7b21ebc51; jvm 10.0.1+10

...

[INFO] 1 Spring WebApplicationInitializers detected on classpath
2018-10-08 15:11:50 [main] DEBUG com.mkyong.web.WebInitializer - No ContextLoaderListener registered, as createRootApplicationContext() did not return an application context
[INFO] DefaultSessionIdManager workerName=node0
[INFO] No SessionScavenger set, using defaults
[INFO] node0 Scavenging every 660000ms
[INFO] Initializing Spring DispatcherServlet 'dispatcher'
[INFO] Started o.e.j.m.p.JettyWebAppContext@68a78f3c{/,file:///D:/java-web-project/src/main/webapp/,AVAILABLE}{file:///D:/java-web-project/src/main/webapp/}
[INFO] Started ServerConnector@3355168{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
[INFO] Started @6271ms
[INFO] Started Jetty Server
2018-10-08 15:12:01 [qtp1373051324-19] DEBUG c.m.web.controller.WelcomeController - Welcome to mkyong.com...

7.2 Access it via http://localhost:8080/

P.S CTRL + C to stop the Jetty web server.

8. Deployment

8.1 mvn package to generate a WAR file for deployment.


D:\> mvn package

...

[INFO] Packaging webapp
[INFO] Assembling webapp [java-web-project] in [D:\java-web-project\target\java-web-project]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\java-web-project\src\main\webapp]
[INFO] Webapp assembled in [89 msecs]
[INFO] Building war: D:\java-web-project\target\java-web-project.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.844 s
[INFO] Finished at: 2018-10-08T15:31:12+08:00
[INFO] ------------------------------------------------------------------------

The default directory for the generated WAR is target/finalName. Done.

Download Source Code

$ git clone https://github.com/mkyong/maven-examples.git
$ cd java-web-project
$ mvn jetty:run

http://localhost:8080

References

  1. Maven Surefire Plugin – Using JUnit 5 Platform
  2. Maven – List all the project’s plugins
  3. Maven – Introduction to the Standard Directory Layout
  4. Apache Tomcat Maven Plugin
  5. Maven – How to create a Java project
  6. Spring MVC tutorials

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
90 Comment threads
30 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
92 Comment authors
MwauraLizAnkit KotakGiuseppeKai Recent comment authors
newest oldest most voted
Peter
Guest
Peter

Wonderful! my first runnable spring mvc

Rafael Paredes
Guest
Rafael Paredes

Hi,

I had a run compilation error due the “mvn tomcat:run” started Tomcat 6 but the classes are in Java 7.
A quick fix: use tomcat7:run
It could happen because I have installed tomcat6 and 7.

trackback
How to convert Maven based web application to support Eclipse IDE

[…] last tutorial, you created a ,web application with Maven. Here’s a guide to show you how to convert the Maven based web application to support Eclipse […]

Radha
Guest
Radha

Hey MK you are awesome. Thanks for these tutorials they have saved me so much time!

Gagandeep Singh
Guest
Gagandeep Singh

using the -DgroupId=com.store.controllers here.. was needless since it didn’t create the package although the webApp was successfully created.

mvn archetype:generate -DgroupId=com.store.controllers -DartifactId=shoppersStop -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

I would say .. that the project folder structure was partially created ..
well but at least I am happy that I am learning maven no matter if in parts.. haha..

But thanks .. mkyong!!! you are the best when it comes to practising technologies.

pradeep
Guest
pradeep

i did same what you have written in the above but the directory mkyongweb-core is created but in that folder webapp->WEB-INF-> web.xml is not created.

why is not created ?
How can i resolve this problem?

Thanks,
Pradeep

dli7mar
Guest
dli7mar

Hi, will you please explain the details of running in tomcat?
>In Eclipse, create a server instance, add above “primefaces” web project and start it.

Racs
Guest
Racs

Hi Mkyong, this is cool! Thanks for a very detailed (and working) solution. 🙂

trackback
spring maven repository issue (blog references but wanting to use newer version) | Jisku.com - Developers Network
trackback
Create embedded Jetty 8 web application context using Maven standard webapp layout

[…] I recently created a web application using the standard Maven webapp layout […]

jssay
Guest
jssay

thanks for your posting, this is very detailed and helpful. thanks again.

dli7mar
Guest
dli7mar

Hi mkyong, I have a maven3/jpa2/tomcat7/eclipse project, which has these jpa related dependencies in its pom.xml: <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.6.5.Final</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.hibernate.javax.persistence</groupId> <artifactId>hibernate-jpa-2.0-api</artifactId> <version>1.0.0.Final</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.6.7.Final</version> </dependency> After running ‘mvn eclipse:eclipse’ command, I could see hiberante-entitymanager-3.6.5.Final.jar in the project. But after running ‘mvn package’ commeand, this jar file did not go $my_project\target\my_project\WEB-INF\lib fold. When I deply the war file to tomcat, I need to manually copy/paste this jar file to tomcat to run it. Do you know why this issue happened? Any idea is greatly appreciated. Thank you so much.

yasser
Guest
yasser

thank you very much very nice and usful lesson .i bookmark this site ,i love it coz i want learn programming .. thanks alot

Igor
Guest
Igor

Hi MK,

maven-archetype-webapp creates directory structure without standard src/main/java folder. In this tutorial i can’t find part where src/main/resources is renamed to src/main/java.

Thanks,
Igor

Dave Potts
Guest
Dave Potts

I tried this, when I tried to import it into Eclipse, eclipse bailed out with an internal error.

I then attempted to repeat the procedure from within eclipse, following the instructions from https://docs.sonatype.org/display/M2ECLIPSE/WTP+mini+howto, which is the offical support site for the maven plugin used in this demo.
[Also includes instructions on how to create a java source folder]

Result Eclipse did not die and I can correctly configured eclipse/maven web project.

Leo
Guest
Leo

For convenience, we can declare maven-eclipse-plugin in file pom.xml to avoid typing the parameter “-Dwtpversion=2.0” when use command mvn eclipse:eclipse.


			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<version>2.8</version>
				<configuration>
					<downloadSources>true</downloadSources>
					<downloadJavadocs>false</downloadJavadocs>
					<wtpversion>2.0</wtpversion>
				</configuration>
			</plugin>
Sijo
Guest
Sijo

Hello sir, how can I create a Maven Java Application with Netbeans ?

Amarjit
Guest
Amarjit

Hi MK for me .class and .project file is not created please help to resolve this problem asap

dli7mar
Guest
dli7mar

I have a maven web project and defined tomcat7 as web server in eclipse. But I couldn’t add this project to tomcat server because it is not in the available list.
How could I add a maven web project to eclipse tomcat server?

Many Thanks.

Hayk
Guest
Hayk

Hi , when I download your source zip folder and try to deploy it displays an error in console”

 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/CounterWebApp/welcome] in DispatcherServlet with name 'mvc-dispatcher'

I suppose in mvc-dispatcher-servlet.xml there should be this line:

<mvc:annotation-driven/>

can you please help me?

Hayk
Guest
Hayk

Hi there is a little mistake in your project:
please add this line in your dispatcher xml file

<context:annotation-config/>

otherwise controller is not being found…

Anonymous
Guest
Anonymous

I’m really enjoying the theme/design of your site. Do you ever run into any internet browser compatibility issues? A couple of my blog audience have complained about my blog not operating correctly in Explorer but looks great in Chrome. Do you have any ideas to help fix this problem?

webhosting wordpress
Guest
webhosting wordpress

I know this if off topic but I’m looking into starting my own weblog and was wondering what all is needed to get setup? I’m assuming having a blog
like yours would cost a pretty penny? I’m not very internet smart so I’m not 100% positive. Any recommendations or advice would be greatly appreciated. Thanks

Hilda
Guest
Hilda

Hi, I do believe this is an excellent web site. I stumbledupon it 😉
I am going to revisit yet again since I bookmarked it.
Money and freedom is the greatest way to change, may you be rich and continue to guide other people.

Sarath
Guest
Sarath

when i am trying to run the mvn package from eclipse i am gettin the error as mentioned below, but when i am runningfrom command prompt, its working fine can you please suggest how we can run through eclipse. Error getting default plugin information: for project org.apache.maven.project.ProjectBuildingException: Error getting default plugin information: for project at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:141) at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:81) at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:293) at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:241) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:109) at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:534) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:167) at org.apache.maven.cli.MavenCli.main(MavenCli.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:408) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:351) at org.codehaus.classworlds.Launcher.main(Launcher.java:31) Caused by: org.apache.maven.lifecycle.LifecycleExecutionException: Error getting default plugin information: at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getDefaultPluginConfiguration(DefaultLifecycleExecutor.java:914) at… Read more »

Maulana
Guest
Maulana

Hello,
I’m a newbie for eclipse and java. my background was Delphi and VB. now I’m learning java and eclipse. it is quite interesting to build web application using maven. but what if I want to create java project using maven, what archetype should I use, while in eclipse when I choose the maven project a lot of maven archetype can we select, and what if I separate the front end project (web application) and back end project (i.e for connecting to database) what should I do then.

thank you

Pierluigi
Guest
Pierluigi

you are a cool guy MK, your tutorial really helped me getting started with Maven… all this XML is a nightmare anyway. I am looking for alternatives because all that XML visual noise drives me crazy.

chinmay
Guest
chinmay

Hi ,
Can you let me know how to import a web project in eclipse ?I am not able to do it.

Regards
Chinmay

Read the Full Document
Guest
Read the Full Document

I have learn several just right stuff here. Definitely worth bookmarking for revisiting.
I surprise how a lot effort you put to make such a excellent informative web site.

Alket
Guest
Alket

Hi, are you using Java EE for this example or just Java SE ?