2011-09-15 64 views

回答

6

按照this blog post中所述使用乙醚。

/** 
* The current repository/network configuration of Maven. 
* 
* @parameter default-value="${repositorySystemSession}" 
* @readonly 
*/ 
private RepositorySystemSession repoSession; 

现在通过RepositorySystemSession.getLocalRepository()得到当地回购:

LocalRepository localRepo = repoSession.getLocalRepository(); 

LocalRepositorygetBasedir()方法,这可能是你想要的。

+0

如何在Maven插件单元测试中做同样的事情? –

+0

@DmytroChyzhykov不知道,你应该问一个单独的问题 –