This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 205013 - Maven repo omits all OSGi bundles
Summary: Maven repo omits all OSGi bundles
Status: VERIFIED FIXED
Alias: None
Product: www
Classification: Unclassified
Component: Builds & Repositories (show other bugs)
Version: 7.1
Hardware: All All
: P2 normal (vote)
Assignee: pgebauer
URL: https://jira.codehaus.org/browse/MNBM...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-11 18:04 UTC by Jesse Glick
Modified: 2011-12-08 17:21 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Test case (12.63 KB, application/zip)
2011-12-08 17:20 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2011-11-11 18:04:36 UTC
While numerous modules declare direct dependencies on OSGi bundles, these are not listed in e.g. org.netbeans.cluster:ide:RELEASE71-BETA:pom. Nor are these mentioned as Maven dependencies in module POMs such as org.netbeans.modules:org-netbeans-modules-bugzilla:RELEASE71-BETA. The result is that when you try to run a Maven Platform app @ RELEASE71-BETA w/ ide (and perhaps other) clusters enabled, it fails even with <useOSGiDependencies>true</useOSGiDependencies>, for example:

org.netbeans.modules.bugzilla - The module named org.apache.commons.httpclient was needed and not found.

This means that the Maven repo generation script is not handling the newly introduced bundles. I will investigate whether this is a bug in PopulateRepositoryMojo.
Comment 1 Jesse Glick 2011-11-11 19:52:55 UTC
Confirmed bug in mojo. Will try to fix and release; NB generation script will then need to use a newer plugin version.
Comment 2 Jesse Glick 2011-11-12 00:08:11 UTC
I uploaded https://nexus.codehaus.org/content/repositories/snapshots/org/codehaus/mojo/nbm-maven-plugin/3.7-SNAPSHOT/nbm-maven-plugin-3.7-20111111.235916-2.jar with the fix. If I do not get to release 3.7 before the next Maven repo generation, this snapshot will need to be used instead. Easy to verify that the correct version is being used because org/netbeans/cluster/ide/*/ide-*.pom should include e.g.

    <dependency>
      <groupId>org.netbeans.external</groupId>
      <artifactId>com-jcraft-jsch</artifactId>
      <version>...</version>
    </dependency>

org/netbeans/modules/org-netbeans-libs-git/*/org-netbeans-libs-git-*.pom should include the same <dependency>.

My end-to-end testing: created an NBM app, set a custom local <repository> and <netbeans.version>, configured <useOSGiDependencies>true</useOSGiDependencies> (note that this is still using the 3.6 plugin), added to application/pom.xml

        <dependency>
            <groupId>org.netbeans.cluster</groupId>
            <artifactId>ide</artifactId>
            <version>${netbeans.version}</version>
            <type>pom</type>
        </dependency>

and built and ran the app. Bundles were unpacked to extra cluster (unlike an NBM there is no way to define the targetcluster attr) and loaded apparently normally when the IDE started.
Comment 3 pgebauer 2011-11-22 19:39:30 UTC
Currently, the following command is used for maven generation:
mvn -DdeployUrl=$MAVEN_REPO_URL -DforcedVersion=$MAVEN_VERSION -DnetbeansInstallDirectory=nbrepo/netbeans -DnetbeansJavadocDirectory=nbrepo/javadoc -DnetbeansNbmDirectory=nbrepo/nbms -DnetbeansSourcesDirectory=nbrepo/source-zips -DnexusIndexDirectory=nbrepo/nexus/ -DskipInstall=true org.codehaus.mojo:nbm-maven-plugin:3.5:populate-repository


What should it be used instead of "org.codehaus.mojo:nbm-maven-plugin:3.5:populate-repository" in order that the locally installed nbm-maven-plugin-3.7-20111111.235916-2.jar file runs?
Comment 4 Jesse Glick 2011-11-22 20:31:34 UTC
org.codehaus.mojo:nbm-maven-plugin:3.7-SNAPSHOT:populate-repository
Comment 5 pgebauer 2011-11-22 22:47:21 UTC
Once I change "org.codehaus.mojo:nbm-maven-plugin:3.5:populate-repository" to "org.codehaus.mojo:nbm-maven-plugin:3.7-SNAPSHOT:populate-repository", the build job reports:

[INFO] Scanning for projects...
[WARNING] The POM for org.codehaus.mojo:nbm-maven-plugin:jar:3.7-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------


even though the file "nbm-maven-plugin-3.7-20111111.235916-2.jar" is copied into the directory "~/.m2/repository/org/codehaus/mojo/nbm-maven-plugin/3.7"

Any tip what could be wrong?
Comment 6 pgebauer 2011-11-23 13:44:15 UTC
OK, I was able to install the plugin version but I still get error. It seems like a problem wit the plugin itself. Am I right?


[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:nbm-maven-plugin:3.7-SNAPSHOT:populate-repository (default-cli) on project standalone-pom: Execution default-cli of goal org.codehaus.mojo:nbm-maven-plugin:3.7-SNAPSHOT:populate-repository failed: Unable to load the mojo 'populate-repository' in the plugin 'org.codehaus.mojo:nbm-maven-plugin:3.7-SNAPSHOT'. A required class is missing: org/apache/maven/shared/dependency/tree/traversal/DependencyNodeVisitor
Comment 7 Jesse Glick 2011-11-23 15:35:24 UTC
(In reply to comment #5)
> [WARNING] The POM for org.codehaus.mojo:nbm-maven-plugin:jar:3.7-SNAPSHOT is
> missing, no dependency information available
> 
> even though the file "nbm-maven-plugin-3.7-20111111.235916-2.jar" is copied
> into the directory "~/.m2/repository/org/codehaus/mojo/nbm-maven-plugin/3.7"

Your local repo dir is missing the matching *.pom, and probably other required files such as maven-metadata.xml.

(In reply to comment #6)
> Unable to load the mojo 'populate-repository' in the plugin
> 'org.codehaus.mojo:nbm-maven-plugin:3.7-SNAPSHOT'. A required class is missing:
> org/apache/maven/shared/dependency/tree/traversal/DependencyNodeVisitor

Sounds like a dependency of the plugin is missing too. Did you just try to copy this one JAR file manually? That will not work I think. Easiest is to run 'mvn install' from source on the target machine.

(Using a snapshot version of a plugin is easy when declared in a POM; you just declare the <repository> hosting it, request the snapshot <version>, and Maven does the rest. I do not know if there is any equivalent technique for running a plugin goal directly from the command line.)
Comment 8 Jesse Glick 2011-11-23 15:42:52 UTC
You could also probably use dependency:get [1] to download this artifact along with all its dependencies and metadata. That would let you explicitly specify the snapshot repo.

[1] http://maven.apache.org/plugins/maven-dependency-plugin/get-mojo.html
Comment 9 pgebauer 2011-11-30 14:27:00 UTC
(In reply to comment #7)
> Sounds like a dependency of the plugin is missing too. Did you just try to copy
> this one JAR file manually? That will not work I think. Easiest is to run 'mvn
> install' from source on the target machine.

Yes, the snapshot plugin has been installed via the install maven command and the error above has been reported after the installation.

> You could also probably use dependency:get [1] to download this artifact along
> with all its dependencies and metadata.

The command:

mvn dependency:get -DrepositoryUrl=http://repository.codehaus.org/

returns

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:get (default-cli) on project standalone-pom: The parameters 'repositoryUrl' for goal org.apache.maven.plugins:maven-dependency-plugin:2.1:get are missing or invalid
Comment 10 Jesse Glick 2011-11-30 19:06:34 UTC
(In reply to comment #9)
> the snapshot plugin has been installed via the install maven command and
> the error above has been reported after the installation.

Not sure, works for me.

> mvn dependency:get -DrepositoryUrl=http://repository.codehaus.org/

Well you have to pass the other required params, not just repositoryUrl! Anyway that is the wrong server.
Comment 11 Jesse Glick 2011-11-30 19:07:50 UTC
Try deleting relevant sections of the local repo and redoing the 'mvn install' command - possible your earlier attempts corrupted it somehow.
Comment 12 Jesse Glick 2011-12-02 22:43:17 UTC
You might have run into something related to bug #205865. Simplest workaround is to run any goal of the plugin using the parameter

  -Dnetbeans.execution=true

which will fail, but download plexus-util-1.1.jar in the process; then try again without this parameter. Failing that, check out and reinstall from its new source location:

https://svn.codehaus.org/mojo/trunk/mojo/nbm-maven
Comment 13 pgebauer 2011-12-08 14:39:44 UTC
Finaly!! The deletion of local maven repo together with download of nbm-maven-plugin-3.7-20111111.235916-2.pom.xml file and with the following command have helped:

mvn install:install-file -Dfile=./nbm-maven-plugin-3.7-20111111.235916-2.jar -DpomFile=./nbm-maven-plugin-3.7-20111111.235916-2.pom.xml -DartifactId=nbm-maven-plugin  -Dversion=3.7-SNAPSHOT  -Dpackaging=jar -DgroupId=org.codehaus.mojo

Please, verify the result at the internal server.
Comment 14 Jesse Glick 2011-12-08 17:20:24 UTC
Created attachment 113969 [details]
Test case
Comment 15 Jesse Glick 2011-12-08 17:21:13 UTC
Confirmed with attached project; when run, can create and use a new Bugzilla connection, making use of OSGi-based Mylyn connectors.