2

I've just started using Maven in NetBeans. However, I can't seem to figure out why src/main/resources is not included on the classpath when I run the project using Run / Run Main Config. From what I can see, only /target/classes/ is included in the classpath, in addition to JARs from dependencies.

My impression was that src/main/resources is a standard location and should always be in the classpath, but this is not the case here. What am I doing wrong?

1 Answer 1

3

By default, the Maven Resources plugin will copy resource files from src/main/resources to target/classes, so they should still be available on the classpath.

Sign up to request clarification or add additional context in comments.

3 Comments

yes, but the IDE build can do it too. not sure about netbeans, but IDEA's build/maven integration does it automatically...
@iangreen: While that's true, it's not usually a good idea to rely solely on IDE behavior to successfully build a project. Delegating this to a Maven plugin ensures that the project can be successfully built in CI or by any developer familiar with Maven, regardless of the other tools they may be using.
I am clueless as to how to use the above plugin in Netbeans... can you give some directions?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.