There is a maven project A. Once I do mvn clean install, the project builds and the jar is available at my local repository ie
c:
epositorycomstackoverflowAA.jar
A.jar contains couple of classes and xml files used by these classes
From another maven project I am invoking one of the methods in the class which uses one XML file.
Code is:
public File xmlFilder(String xmlAbsolutePath) {
File f = new File(xmlAbsolutePath);
return f;
}
The second project is located in my D drive. On getting the absolute path, I am getting as comstackoverflowA
esp.xml which is the correct absolute path.
But If I add the following code at line 3 , I am getting as follows:
public File xmlFilder(String xmlAbsolutePath) {
File f = new File(xmlAbsolutePath);
System.out.println("AbsolutePath----"+f.getAbsolutePath()); ---> D:comstackoverflowA
esp.xml
System.out.println("getPath------------"+f.getPath()); ---> comstackoverflowA
esp.xml
System.out.println("exists--------------"+f.exists()); ----> false
return f;
}
Can anyone please let me know where I am going wrong. Why it is not picking the xml from the repository which is present in C drive.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…