user496949
user496949

Reputation: 86085

why the current directory not the target\classes?

Using maven for a project say myproject

it has the following myproject\src and myproject\target, and all the class and resources are copied to myproject\target\classes.

However i found the user.dir or current dir is still myproject, why not myproject\target\classes, how to change the current dir to myproject\target\classes?

Upvotes: 0

Views: 3440

Answers (2)

Matt
Matt

Reputation: 11805

Because maven always runs things in the working directory of the pom.xml, unless you configure it differently (which i think you can do in the surefire plugin which is what runs test cases).

Upvotes: 2

Jason
Jason

Reputation: 1241

If you want to get class folder path,you can following this code :

    String path  = YourClassName.class.getResource("").getPath();

Upvotes: 2

Related Questions