What is the purpose of the resource folder in Maven?

Using Eclipse that was previously used in a project by another developer. Most of the items are marked as red and broken. Viewing files in src/main/java/...

the same exact files in javaresources/src/main/java...

Just confused about what temp is, what to store, or how to fix the project environment.

Anyone easy to fix this?


source to share

3 answers

There is no standard for anything at the root level called resources




you are putting non-Java artifacts that need to be moved into the normal package hierarchy, such as XML configuration files loaded as class resources.

There is no way to help much beyond this, other than to say "check your Maven file to see if the links actually reference them", especially if something generates files there or moves them there as part of the build process, but again, this would be non-standard using Maven.



Your question has multiple answers as they already exist all over the place and are easy to obtain. I just point you to them with links and a small description.

What is Maven?

  • Maven is a build tool, it helps you manage dependencies (banks) easily and efficiently.
  • Maven does everything that ANT can do, even has a plugin to do specific ANT actions.
  • Very easy to migrate from 3rd party library.
  • Unit testing is also easy to customize, the general configuration is very simple.

For more information -> http://maven.apache.org/what-is-maven.html

Why Maven?

Why are so few people using Maven? Are there alternative tools?

Why resource catalog?

Before maven existed, we used a resource bundle in an application that would actually contain an application configuration properties file, internalization properties files, XML files (mostly not Java files needed to run applications).

In one case, I used the resource directory

In our company, we wanted to have different property values ​​for development, staging, pre-preparation, environment creation. Thus, we had four directories and a Resources folder with the name enviornment. Each directory will contain its own properties and properties files. During maven build, we have to specify which profile this build is for .. Based on the fact that only certain resource files are loaded into the deployment build.

More info on profile in maven -> http://maven.apache.org/guides/introduction/introduction-to-profiles.html

Eclipse problem solution

And your eclipse has red flags needed to fix build path errors if it gets the correct source. The corrected flags will disappear. Since you didn't mention what errors you are seeing, I am posting a general discussion about fixing the build path -> Java Buildpath problem in Eclipse



Go to the Project folder for example. MyProject on the command line

run below commands one by one (assuming you have maven installed on your system)

cd  C:\MyWorkSpace
cd  MyProject
mvn clean install -DskipTests=true
mvn eclipse:eclipse


and then right click your project and click "Refresh"

This might solve your problem.



All Articles