Question

In: Computer Science

Create a Maven project in NetBeans using the maven-archetype-quickstart template, with Group Id: com.lastname.firstname and Artifact...

Create a Maven project in NetBeans using the maven-archetype-quickstart template, with Group Id: com.lastname.firstname and Artifact Id: exam2p1.

2. Use search.maven.org and/or mvnrepository.com to find three different artifacts that you will demonstrate in your project. a. Each artifact you use should be in a different category (e.g. cloud, JSON, regex, etc.). Hint: You can search by category at mvnrepository.com. DO NOT USE any artifact we have already used in a project in-class assignments or demos. b. Make sure you can find enough documentation as to what each artifact does, so you are actually able to use its API in your project. There might be a Github repo or other website with the documentation – you may have to research this. If you cannot find sufficient documentation, choose another artifact.

3. Add the dependencies for all three chosen artifacts to your project.

4. Demonstrate at least 2 functionalities from each artifact in your program (use whatever imports, methods, and objects from each module as necessary). Show your results as output to the screen (if your demo includes file manipulation, state what happened as part of your program output, and include the result file(s) in your project’s directory for submission).

5. Fully comment on your program so someone can look at the code and understand quickly what it is about. Describe the purpose of each piece of code you use from the artifacts.

6. It should be obvious what your program is trying to do for anyone who reads the output. Suggestion: label each section of your output with the name of the artifact being demonstrated.

I need my code to be in Java Programming language with fully comment on the program?

Solutions

Expert Solution

$ mvn archetype:generate -DgroupId=com.journaldev.java -DartifactId=java-app -DarchetypeArtifactId=maven-archetype-quickstart [

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 Interactive mode Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.0/maven-archetype-quickstart-1.0.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.0/maven-archetype-quickstart-1.0.pom (703 B at 1.3 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-bundles/2/maven-archetype-bundles-2.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-bundles/2/maven-archetype-bundles-2.pom (1.5 kB at 2.8 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/maven-archetype-parent/1/maven-archetype-parent-1.pom Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/maven-archetype-parent/1/maven-archetype-parent-1.pom (1.3 kB at 2.5 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.0/maven-archetype-quickstart-1.0.jar Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.0/maven-archetype-quickstart-1.0.jar (4.3 kB at 7.9 kB/s) [INFO] Using property: groupId

= com.journaldev.java [

INFO

] Using property: artifactId = java-app Define

value

for

property

'version'

1.0

-SNAPSHOT: : [

INFO

] Using property: package = com.journaldev.java Confirm properties configuration: groupId: com.journaldev.java artifactId: java-app version:

1.0

-SNAPSHOT package: com.journaldev.java Y: : y [

INFO

] ---------------------------------------------------------------------------- [

INFO

]

Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.0 [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: basedir, Value: /Users/pankaj/Desktop/maven-examples [INFO] Parameter: package, Value: com.journaldev.java [INFO] Parameter: groupId, Value: com.journaldev.java [INFO] Parameter: artifactId, Value: java-app [INFO] Parameter: packageName, Value: com.journaldev.java [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] project created from Old (1.x) Archetype in dir: /Users/pankaj/Desktop/maven-examples/java-app [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 21.103 s [INFO] Finished at: 2019-12-05T13:23:58+05:30 [INFO] ------------------------------------------------------------------------

If you look at the output, the maven is confirming project configurations. We can skip this using the -DinteractiveMode=false argument.

Now, let's try to understand what is happening behind the scene of this command.

Archetype is a maven project templating toolkit. It's a great way to create maven projects from the command line. The archetype:generate tells maven that we have to generate a maven project from the additional information provided in the command.

Every maven project requires some specific configurations, such as groupId, artifactId, package.

For further information you can go to https://netbeans.org/kb/docs/javaee/maven-entapp.html


Related Solutions

in Java using netbeans create a project and in it a class with a main. We...
in Java using netbeans create a project and in it a class with a main. We will be using the Scanner class to read from the user. At the top of your main class, after the package statement, paste import java.util.Scanner; Part A ☑ In your main method, paste this code. Scanner scan = new Scanner(System.in); System.out.println("What is x?"); int x = scan.nextInt(); System.out.println("What is y?"); int y = scan.nextInt(); System.out.println("What is z?"); int z = scan.nextInt(); System.out.println("What is w?");...
in Java using netbeans create a project and in it a class with a main. We...
in Java using netbeans create a project and in it a class with a main. We will be using the Scanner class to read from the user. At the top of your main class, after the package statement, paste import java.util.Scanner; Part A ☑ In your main method, paste this code. Scanner scan = new Scanner(System.in); System.out.println("What is x?"); int x = scan.nextInt(); System.out.println("What is y?"); int y = scan.nextInt(); System.out.println("What is z?"); int z = scan.nextInt(); System.out.println("What is w?");...
in netbeans using Java Create a project and a class with a main method, TestCollectors. ☑...
in netbeans using Java Create a project and a class with a main method, TestCollectors. ☑ Add new class, Collector, which has an int instance variable collected, to keep track of how many of something they collected, another available, for how many of that thing exist, and a boolean completist, which is true if we want to collect every item available, or false if we don't care about having the complete set. ☑ Add a method addToCollection. In this method,...
Using NetBeans, create a Java project named FruitBasket. Set the project location to your own folder....
Using NetBeans, create a Java project named FruitBasket. Set the project location to your own folder. 3. Import Scanner and Stacks from the java.util package. 4. Create a Stack object named basket. 5. The output shall: 5.1.Ask the user to input the number of fruits s/he would like to catch. 5.2.Ask the user to choose a fruit to catch by pressing A for apple, O for orange, M for mango, or G for guava. 5.3.Display all the fruits that the...
Part A Java netbeans ☑ Create a project and in it a class with a main....
Part A Java netbeans ☑ Create a project and in it a class with a main. We will be using the Scanner class to read from the user. At the top of your main class , after the package statement, paste import java.util.Scanner; As the first line inside your main method, paste Scanner scan = new Scanner(System.in); Remember when you are getting a value from the user, first print a request, then use the Scanner to read the right type...
Create a new Java project using NetBeans, giving it the name L-14. In java please Read...
Create a new Java project using NetBeans, giving it the name L-14. In java please Read and follow the instructions below, placing the code statements needed just after each instruction. Leave the instructions as given in the code. Declare and create (instantiate) an integer array called List1 that holds 10 places that have the values: 1,3,4,5,2,6,8,9,2,7. Declare and create (instantiate) integer arrays List2 and List3 that can hold 10 values. Write a method called toDisplay which will display the contents...
Create a Netbeans project called LineNumbers The program should do the following: –Ask the user for...
Create a Netbeans project called LineNumbers The program should do the following: –Ask the user for how many lines of text they wish to enter –Declare and initialize an array of Strings to hold the user’s input –Use a while loop to prompt for and read the Strings (lines of text) from the user at the command line. Typically, this would be a 'for' loop since we know the number of times to execute the loop based upon the number...
Part 1 – Classes and objects Create a new Java project called usernamePart1 in NetBeans. In...
Part 1 – Classes and objects Create a new Java project called usernamePart1 in NetBeans. In my case the project would be called rghanbarPart1. Select the option to create a main method. Create a new class called Vehicle. In the Vehicle class write the code for: • Instance variables that store the vehicle’s make, model, colour, and fuel type • A default constructor, and a second constructor that initialises all the instance variables • Accessor (getters) and mutator (setters) methods...
2. Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a...
2. Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student gradebook using a two-dimensional array. It should allow the user to enter the number of students and the number of assignments they wish to enter grades for. This input should be used in defining the two-dimensional array for your program. For example, if I say I want to enter grades for 4 students and 5 assignments, your program should define a 4 X...
Create a Netbeans project with a Java main class. (It does not matter what you name...
Create a Netbeans project with a Java main class. (It does not matter what you name your project or class.) Your Java main class will have a main method and a method named "subtractTwoNumbers()". Your subtractTwoNumbers() method should require three integers to be sent from the main method. The second and third numbers should be subtracted from the first number. The answer should be returned to the main method and then displayed on the screen. Your main() method will prove...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT