當前位置: 首頁>>代碼示例>>Java>>正文


Java MavenProject.getModules方法代碼示例

本文整理匯總了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());
            }
        }
    }
    
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:39,代碼來源:OperationsImpl.java

示例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()]);
}
 
開發者ID:tech-microworld,項目名稱:maven-cdn-alioss-plugin,代碼行數:13,代碼來源:MyAbstractMojo.java


注:本文中的org.apache.maven.project.MavenProject.getModules方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。