My steps:
$ mkdir maven-test
$ cd maven-test
$ mvn archetype:generate
I then entered
1313
for the quickstart archetype.
8
for quickstart archetype version 1.4.
info.cameronhudson.18655
for the groupId
lab1
for the artifactId
1.0
for the snapshot version
public-recommendation-service
for the package name
Y
for confirmation
I then entered the new project and tried to install it.
$ cd lab1
$ mvn clean install
This produced the following compilation errors.
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/cameronhudson/Repositories/CMU/18-655_Lab_1_Public_Recommendation_Service/lab1/src/main/java/public-recommendation-service/App.java:[1,8] <identifier> expected
[ERROR] /Users/cameronhudson/Repositories/CMU/18-655_Lab_1_Public_Recommendation_Service/lab1/src/main/java/public-recommendation-service/App.java:[1,15] class, interface, or enum expected
[INFO] 2 errors
App.java
contains (by default):
package public-recommendation-service;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
My java version:
$ java --version
java 11.0.2 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+7-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+7-LTS, mixed mode)
Package names must be valid Java identifiers. That means that your package name is invalid for 2 reasons.
There are hyphens, which are not allowed in an identifier. The parser in the compiler thinks that the identifier is the portion of your package name before the first hyphen, which is public
. That is a keyword and not allowed as an identifier.
Try a different package name such as public_recommendation_service
or pubrecservice
.