简体   繁体   中英

Creating java classes and java package on command line using maven

I have created a java spring mvc application using eclipse and ii am running it using java mvn on my command line mvn package and mvn tomcat7:run and everything works out. However, i want to generate a new java package. I have this packages that already exists

在此处输入图片说明

com.boilerplate.configs
com.boilerplate.controllers
com.boilerplate.models
com.boilerplate.services

are all packages i created while i was on eclipse. Inside each package, there are classes that i have created,for instance there is a class BoilerplateController.java inside of controllers.

How can i add a package using for instance com.boilerplate.aws using maven or java?.

A package is just a directory. Use a file explorer or command line stuff.

In java, you could write

new File("src/main/java/com/boilerplate/package2").mkdirs()

But you are probably mistaking the concepts here. Use the IDE, such as Eclipse, to write the code, and use mvn to build it and java to execute it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM