Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add maven project into intellij idea if pom.xml is not in the root level

It's been 2 days and I'm pulling my hairs out at this point.
I'm new to java development - trying to get the project imported into intellij IDEA that has following file structure:

project_dir
  data_files
     file1.json
     file2.json
     ..
  doc_files
     file1.md5
     file2.md5
  java_project
     src/*
     pom.xml
  readme.md
  .git
  .gitignore

I don't understand how to import such project into intellij so it still compiles and I can still see non java directories like data_files and doc_files.

So here's what I've tried:

a) I can go into intellij => open => select project_dir folder. Then I can see all of the files but project doesn't compile. IDE complains that dependencies are not defined. If i right click on pom.xml and select "add as a maven project" -> intellij replaces project root with java_project directory ang I cannot see data_files and doc_files anymore.

b) intellij => open => select pom.xml file. I can see source files and project compiles, but I cannot see data_files and doc_files and cannot add them.

Any help is welcome. Thanks

like image 561
Dannyboy Avatar asked Sep 10 '25 10:09

Dannyboy


1 Answers

Did you try

File -> 
New ->
Project from Existing Sources ->
select the pom ->
set the root directory to project_dir

fyi a more typical maven layout would be

project_dir
  data_files
    file1.json
    file2.json
    ..
  doc_files
    file1.md5
    file2.md5
  src/*
  pom.xml
  readme.md
 .git
 .gitignore
like image 137
Nathanial Avatar answered Sep 13 '25 01:09

Nathanial