本文整理匯總了Java中org.apache.maven.project.MavenProject.getModules方法的典型用法代碼示例。如果您正苦於以下問題:Java MavenProject.getModules方法的具體用法?Java MavenProject.getModules怎麽用?Java MavenProject.getModules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.maven.project.MavenProject
的用法示例。
在下文中一共展示了MavenProject.getModules方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkParentProject
import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
private void checkParentProject(FileObject projectDir, final boolean delete, final String newName, final String oldName) throws IOException {
final String prjLoc = projectDir.getNameExt();
FileObject fo = projectDir.getParent();
Project possibleParent = ProjectManager.getDefault().findProject(fo);
if (possibleParent != null) {
final NbMavenProjectImpl par = possibleParent.getLookup().lookup(NbMavenProjectImpl.class);
if (par != null) {
FileObject pomFO = par.getProjectDirectory().getFileObject("pom.xml"); //NOI18N
if(pomFO != null) {
ModelOperation<POMModel> operation = new ModelOperation<POMModel>() {
@Override
public void performOperation(POMModel model) {
MavenProject prj = par.getOriginalMavenProject();
if ((prj.getModules() != null && prj.getModules().contains(prjLoc)) == delete) {
//delete/add module from/to parent..
if (delete) {
model.getProject().removeModule(prjLoc);
} else {
model.getProject().addModule(prjLoc);
}
}
if (newName != null && oldName != null) {
if (oldName.equals(model.getProject().getArtifactId())) {
// is this condition necessary.. why not just overwrite the artifactID always..
model.getProject().setArtifactId(newName);
}
}
}
};
Utilities.performPOMModelOperations(pomFO, Collections.singletonList(operation));
} else {
Logger.getLogger(OperationsImpl.class.getName()).log(Level.WARNING, "no pom found for a supposed project in {0}", par.getProjectDirectory());
}
}
}
}
示例2: buildExcludes
import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
@SuppressWarnings({ "unchecked" })
private String[] buildExcludes() {
List<String> ex = new ArrayList<String>();
ex.addAll(asList(this.excludes));
MavenProject project = getProject();
if (project != null && project.getModules() != null) {
for (String module : (List<String>) project.getModules()) {
ex.add(module + "/**");
}
}
return ex.toArray(new String[ex.size()]);
}