diff --git a/maven/src/org/netbeans/modules/maven/classpath/CPExtender.java b/maven/src/org/netbeans/modules/maven/classpath/CPExtender.java --- a/maven/src/org/netbeans/modules/maven/classpath/CPExtender.java +++ b/maven/src/org/netbeans/modules/maven/classpath/CPExtender.java @@ -95,15 +95,6 @@ private Project project; private static final String POM_XML = "pom.xml"; //NOI18N - /** - * ClassPath for compiling only, but not running. In practice this means that scope - * for the artefacts with this classpath will be set to provided - * if added to a source group, and test if added to test source group. - * This constant is in practice a friend API, even if it is hardcoded in the - * consuming module (see e.g. bug 186221). - */ - public static final String CLASSPATH_COMPILE_ONLY = "classpath/compile_only"; - public CPExtender(Project project) { this.project = project; } @@ -256,7 +247,7 @@ return new String[] { ClassPath.COMPILE, ClassPath.EXECUTE, - CLASSPATH_COMPILE_ONLY, + JavaClassPathConstants.COMPILE_ONLY, JavaClassPathConstants.PROCESSOR_PATH }; } @@ -343,11 +334,6 @@ dependency.setVersion(mp.getVersion()); if (scope != null) { dependency.setScope(scope); - } else { - if (NbMavenProject.TYPE_EJB.equals(nbprj.getPackagingType()) || - NbMavenProject.TYPE_WAR.equals(nbprj.getPackagingType())) { - dependency.setScope(Artifact.SCOPE_PROVIDED); - } } added.set(true); } else { @@ -394,7 +380,7 @@ scope = "test"; //NOI18N } if (scope == null && - (CLASSPATH_COMPILE_ONLY.equals(type) || JavaClassPathConstants.PROCESSOR_PATH.equals(type))) { + (JavaClassPathConstants.COMPILE_ONLY.equals(type) || JavaClassPathConstants.PROCESSOR_PATH.equals(type))) { scope = Artifact.SCOPE_PROVIDED; } return scope; diff --git a/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java b/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java --- a/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java +++ b/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java @@ -161,9 +161,6 @@ return getBootClassPath(); } else if (type.equals(ClassPathSupport.ENDORSED)) { return getEndorsedClassPath(); - } else if (type.equals("classpath/packaged")) { //NOI18N - //a semi-private contract with visual web. - return getProvidedClassPath(); } else if (type.equals(JavaClassPathConstants.PROCESSOR_PATH)) { // XXX read from maven-compiler-plugin config return getCompileTimeClasspath(fileType); @@ -172,16 +169,6 @@ } } - private synchronized ClassPath getProvidedClassPath() { - ClassPath cp = cache[7]; - if (cp == null) { - cp = ClassPathFactory.createClassPath(new PackagedClassPathImpl(proj.getLookup().lookup(NbMavenProjectImpl.class))); - cache[7] = cp; - } - return cp; - } - - private boolean isChildOf(FileObject child, URI[] uris) { for (int i = 0; i < uris.length; i++) { FileObject fo = FileUtilities.convertURItoFileObject(uris[i]); diff --git a/maven/src/org/netbeans/modules/maven/classpath/PackagedClassPathImpl.java b/maven/src/org/netbeans/modules/maven/classpath/PackagedClassPathImpl.java deleted file mode 100644 --- a/maven/src/org/netbeans/modules/maven/classpath/PackagedClassPathImpl.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2010 Oracle and/or its affiliates. All rights reserved. - * - * Oracle and Java are registered trademarks of Oracle and/or its affiliates. - * Other names may be trademarks of their respective owners. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common - * Development and Distribution License("CDDL") (collectively, the - * "License"). You may not use this file except in compliance with the - * License. You can obtain a copy of the License at - * http://www.netbeans.org/cddl-gplv2.html - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the - * specific language governing permissions and limitations under the - * License. When distributing the software, include this License Header - * Notice in each file and include the License file at - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the GPL Version 2 section of the License file that - * accompanied this code. If applicable, add the following below the - * License Header, with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * If you wish your version of this file to be governed by only the CDDL - * or only the GPL Version 2, indicate your decision by adding - * "[Contributor] elects to include this software in this distribution - * under the [CDDL or GPL Version 2] license." If you do not indicate a - * single choice of license, a recipient has the option to distribute - * your version of this file under either the CDDL, the GPL Version 2 or - * to extend the choice of license to its licensees as provided above. - * However, if you add GPL Version 2 code and therefore, elected the GPL - * Version 2 license, then the option applies only if the new code is - * made subject to such option by the copyright holder. - * - * Contributor(s): - * - * Portions Copyrighted 2008 Sun Microsystems, Inc. - */ - -package org.netbeans.modules.maven.classpath; - -import java.io.File; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.Dependency; -import org.netbeans.modules.maven.NbMavenProjectImpl; -import org.openide.filesystems.FileUtil; -import org.openide.util.Utilities; - -/** - * - * @author mkleint - */ -class PackagedClassPathImpl extends AbstractProjectClassPathImpl { - - public PackagedClassPathImpl(NbMavenProjectImpl project) { - super(project); - } - - @Override - public URI[] createPath() { - List lst = new ArrayList(); - List arts = getMavenProject().getOriginalMavenProject().getCompileArtifacts(); - List deps = getMavenProject().getOriginalMavenProject().getCompileDependencies(); - List packagedIds = new ArrayList(); - for (Dependency dep : deps) { - if (!Artifact.SCOPE_PROVIDED.equals(dep.getScope())) { - packagedIds.add(dep.getManagementKey()); - } - } - - List assemblies = new ArrayList(); - for (Artifact art : arts) { - String key = art.getGroupId() + ":" + art.getArtifactId() + ":" + art.getType() + (art.getClassifier() != null ? (":" + art.getClassifier()) : ""); //NOI18N - if (art.getFile() != null && packagedIds.contains(key)) { - File fil = FileUtil.normalizeFile(art.getFile()); - // the assemblied jars go as last ones, otherwise source for binaries don't really work. - // unless one has the assembled source jar s well?? is it possible? - if (art.getClassifier() != null) { - assemblies.add(0, fil); - } else { - lst.add(Utilities.toURI(fil)); - } - } else { - //NOPMD //null means dependencies were not resolved.. - } - } - for (File ass : assemblies) { - lst.add(Utilities.toURI(ass)); - } - URI[] uris = new URI[lst.size()]; - uris = lst.toArray(uris); - return uris; - } - -}