"maven-archetype-quickstart" - Default Java Code

Q

What is the default Java code in my "hello" Maven project? I used the "maven-archetype-quickstart" template to generate the project.

✍: FYIcenter.com

A

If you used the "maven-archetype-quickstart" template to generate a project, you will get the default "Hello World!" Java code.

Here is the default Java code:

C:\fyicenter>cd hello

C:\fyicenter\hello>type src\main\java\com\fyicenter\App.java

package com.fyicenter;

/**
 * Hello world!
 *
 */
public class App
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
    }
}

Here is the JUnit test Java code:

C:\fyicenter\hello>type src\test\java\com\fyicenter\AppTest.java

package com.fyicenter;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
 * Unit test for simple App.
 */
public class AppTest
    extends TestCase
{
    /**
     * Create the test case
     *
     * @param testName name of the test case
     */
    public AppTest( String testName )
    {
        super( testName );
    }

    /**
     * @return the suite of tests being tested
     */
    public static Test suite()
    {
        return new TestSuite( AppTest.class );
    }

    /**
     * Rigourous Test :-)
     */
    public void testApp()
    {
        assertTrue( true );
    }
}

Of course, this test program is not doing any real tests at all!

 

Maven Project Build Phases

Maven Project Compilation Output

Using Apache Maven

⇑⇑ FAQ for Apache Maven

2018-10-31, 168👍, 0💬