1

I've already succeed creating java project on vs code. I am installing Java extension pack which is auto install another plugin (like language support by red hat and etc), I am using jdk 8 (jdk1.8.0_241). I am using command palette to create new java project. But my new project doesn't contain pom.xml

Anyway I don't install dedicated maven, only Maven for java extension

I need maven for iReport/jaspers dependencies

RxGianYagami
  • 76
  • 1
  • 10
  • 1
    you should create a maven project not a java project,you could press F1 > then input Create,select Create Maven Project,or refer to [command create maven project](https://stackoverflow.com/a/46727175/10768653) – Leo Zhu Mar 05 '20 at 08:08
  • 1
    ^they ask me "select archtypes", not sure what it's it. usually I did it on netbeans before when I was on college. so I don't know what is it – RxGianYagami Mar 06 '20 at 04:12
  • 1
    In short, Archetype is a Maven project templating toolkit.you could look at https://maven.apache.org/guides/introduction/introduction-to-archetypes.html,and you could select `maven-archetype-quickstart` which is an archetype to generate a sample Maven project. – Leo Zhu Mar 06 '20 at 08:31
  • 1
    I've tried type in terminal: mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 but it doesn't work, the error is: The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\bambang.sugianto\Documents\java projects). Please verify you invoked Maven from the correct directory. -> [Help 1] – RxGianYagami Mar 06 '20 at 11:31

2 Answers2

3

You are probably creating a new "Java Project", which is Eclipse-based structure, not Maven.

In the command pallet (Cmd+P on macOS), type Maven and you shall see "Maven: Create Maven Project".

enter image description here

Next step, the extension will ask you which Maven Archetype to use. Select "maven-archetype-quickstart".

enter image description here

You will be asked for input on the terminal after this.

Once the project is generated, type $ code to open a new VSC window.

Done.

Bruno Borges
  • 853
  • 7
  • 24
2

You can execute this by cmd:

mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DgroupId=com.mycompany.app -DartifactId=my-app

This will generate a maven-archetype-quickstar project.

Nahuel Giani
  • 540
  • 6
  • 16