in maven2-server-impl/src/org/jetbrains/idea/maven/server/embedder/CustomArtifact.java [90:151]
private void ensurePomFileExists() {
File f = myWrapee.getFile();
if (f == null || f.exists()) return;
isStub = true;
ourCacheReadLock.lock();
try {
f = ourStubCache.get(getId());
}
finally {
ourCacheReadLock.unlock();
}
if (f != null) {
myWrapee.setFile(f);
return;
}
ourCacheWriteLock.lock();
try {
f = ourStubCache.get(getId());
if (f != null) {
myWrapee.setFile(f);
return;
}
f = FileUtilRt.createTempFile("idea.maven.stub", ".pom");
f.deleteOnExit();
FileOutputStream s = new FileOutputStream(f);
try {
PrintWriter w = new PrintWriter(s);
w.println("<project>");
w.println("<modelVersion>4.0.0</modelVersion>");
w.println("<packaging>pom</packaging>");
w.println("<groupId>" + getGroupId() + "</groupId>");
w.println("<artifactId>" + getArtifactId() + "</artifactId>");
w.println("<version>" + getVersion() + "</version>");
w.println("</project>");
w.flush();
}
finally {
s.close();
}
myWrapee.setFile(f);
ourStubCache.put(getId(), f);
}
catch (IOException e) {
// todo
//try {
// MavenFacadeGlobalsManager.getLogger().warn(e);
//}
//catch (RemoteException e1) {
// throw new RuntimeRemoteException(e1);
//}
}
finally {
ourCacheWriteLock.unlock();
}
}