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 228747 - unable to build against SNAPSHOT with nbm-maven-plugin 3.9, 3.8.1
Summary: unable to build against SNAPSHOT with nbm-maven-plugin 3.9, 3.8.1
Status: RESOLVED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: Milos Kleint
URL: http://jira.codehaus.org/browse/MNBMO...
Keywords:
Depends on: 210438
Blocks:
  Show dependency tree
 
Reported: 2013-04-19 08:18 UTC by mdobacz
Modified: 2013-06-08 01:10 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mdobacz 2013-04-19 08:18:34 UTC
A org-netbeans-modules-apisupport-harness dependency cannot be resolved.

Steps to reproduce:

1) use NB IDE 7.3 to create a vanilla Maven/NetBeans Application from wizard, with a sample module, using RELEASE73 nbp. This will generate pom's with nbm-maven-plugin 3.8 . This project builds without problems.

2) Make following changes to generated parent pom:

- add snapshot repository, e.g.

        <repository>
            <id>netbeans-snapshot</id>
            <name>NBS</name>
            <url>http://bits.netbeans.org/netbeans/trunk/maven-snapshot/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
         </repository>

- change nbm-maven-plugin version to 3.9 (or 3.8.1)

- change netbeans.version property to SNAPSHOT

3) Try to clean build. Build fails with:

Failed to execute goal org.codehaus.mojo:nbm-maven-plugin:3.9:cluster-app (default-cluster-app) on project nbptest-app: Failed to retrieve the nbm file from repository: Could not find artifact org.netbeans.modules:org-netbeans-modules-apisupport-harness:nbm:20130419.055159-1 in netbeans (http://bits.netbeans.org/maven2/)

The artifact actually present ATM is:

http://bits.netbeans.org/netbeans/trunk/maven-snapshot/org/netbeans/modules/org-netbeans-modules-apisupport-harness/SNAPSHOT/org-netbeans-modules-apisupport-harness-20130419.055457-1.nbm

IOW there is a version with deploy time 055457 but build tries to find a version with deploy time 055159.

This generally goes above my NBP+Maven build understanding, so it could well be that the fault is mine...
Comment 1 mdobacz 2013-04-19 08:25:29 UTC
PS the above output in more detail:

------------------------------------------------------------------------
Building nbptest-app 1.0-SNAPSHOT
------------------------------------------------------------------------
Downloading: http://bits.netbeans.org/netbeans/trunk/maven-snapshot/org/netbeans/cluster/platform/SNAPSHOT/maven-metadata.xml
Downloading: http://bits.netbeans.org/maven2/org/netbeans/cluster/platform/SNAPSHOT/maven-metadata.xml
19.4.2013 11:12:29 org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: bits.netbeans.org][path: /nexus][expiry: Fri Apr 19 11:12:29 EEST 2013]". Illegal path attribute "/nexus". Path of origin: "/maven2/org/netbeans/cluster/platform/SNAPSHOT/maven-metadata.xml"

...
...
...

Downloaded: http://bits.netbeans.org/netbeans/trunk/maven-snapshot/org/netbeans/api/org-netbeans-libs-junit4/SNAPSHOT/org-netbeans-libs-junit4-20130419.055333-1.jar (4 KB at 9.6 KB/sec)
                          
Downloaded: http://bits.netbeans.org/netbeans/trunk/maven-snapshot/org/netbeans/modules/org-netbeans-insane/SNAPSHOT/org-netbeans-insane-20130419.055413-1.jar (130 KB at 181.1 KB/sec)
                          
Downloaded: http://bits.netbeans.org/netbeans/trunk/maven-snapshot/org/netbeans/api/org-netbeans-modules-nbjunit/SNAPSHOT/org-netbeans-modules-nbjunit-20130419.055156-1.jar (236 KB at 269.6 KB/sec)

[clean:clean]
Deleting /home/mdobacz/work/temp/nbptest/application/target

[resources:testResources]
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory /home/mdobacz/work/temp/nbptest/application/src/test/resources

[compiler:testCompile]
Compiling 1 source file to /home/mdobacz/work/temp/nbptest/application/target/test-classes

[nbm:cluster-app]
Processing cluster 'platform'
Generating Auto Update information for org.netbeans.core.startup

...
...
...

Generating Auto Update information for com.picturall.nbptest.sample
Created NetBeans module cluster(s) at /home/mdobacz/work/temp/nbptest/application/target/nbptest
Downloading: http://bits.netbeans.org/maven2/org/netbeans/modules/org-netbeans-modules-apisupport-harness/SNAPSHOT/org-netbeans-modules-apisupport-harness-20130419.055159-1.nbm
19.4.2013 11:14:12 org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: bits.netbeans.org][path: /nexus][expiry: Fri Apr 19 11:14:12 EEST 2013]". Illegal path attribute "/nexus". Path of origin: "/maven2/org/netbeans/modules/org-netbeans-modules-apisupport-harness/SNAPSHOT/org-netbeans-modules-apisupport-harness-20130419.055159-1.nbm"
                          
Downloading: http://bits.netbeans.org/netbeans/trunk/maven-snapshot/org/netbeans/modules/org-netbeans-modules-apisupport-harness/SNAPSHOT/org-netbeans-modules-apisupport-harness-20130419.055159-1.nbm
                          
------------------------------------------------------------------------
Reactor Summary:

nbptest-parent .................................... SUCCESS [0.106s]
nbptest-branding .................................. SUCCESS [3.186s]
nbptest-sample .................................... SUCCESS [0.207s]
nbptest-app ....................................... FAILURE [1:43.186s]
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1:47.350s
Finished at: Fri Apr 19 11:14:12 EEST 2013
Final Memory: 24M/212M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:nbm-maven-plugin:3.9:cluster-app (default-cluster-app) on project nbptest-app: Failed to retrieve the nbm file from repository: Could not find artifact org.netbeans.modules:org-netbeans-modules-apisupport-harness:nbm:20130419.055159-1 in netbeans (http://bits.netbeans.org/maven2/)

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=org.netbeans.modules -DartifactId=org-netbeans-modules-apisupport-harness -Dversion=20130419.055159-1 -Dpackaging=nbm-file -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.netbeans.modules -DartifactId=org-netbeans-modules-apisupport-harness -Dversion=20130419.055159-1 -Dpackaging=nbm-file -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]


org.netbeans.modules:org-netbeans-modules-apisupport-harness:nbm-file:20130419.055159-1

from the specified remote repositories:
netbeans (http://bits.netbeans.org/maven2/, releases=true, snapshots=true),
netbeans-snapshot (http://bits.netbeans.org/netbeans/trunk/maven-snapshot/, releases=true, snapshots=true),
central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)
-> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

After correcting the problems, you can resume the build with the command
  mvn <goals> -rf :nbptest-app


***

So it seems it does try to use the snapshot repository...
Comment 2 Milos Kleint 2013-04-19 08:46:47 UTC
have you tried creating the same application with SNAPSHOT repository initially? in wizard, without manual edits.

have you tried running the build with -U (update snapshots?)
The current non-standard thing with nb.org snapshots currently is that we don't keep history of snapshots. the RE guy just builds the snapshot repo on a build server, zips it, scp to bits.n.o and replace the old directory. Therefore the maven local caches could get confused.

>WARNING: Cookie rejected: "[version: 0][name: rememberMe][value:
>deleteMe][domain: bits.netbeans.org][path: /nexus][expiry: Fri Apr 19 11:12:29
>EEST 2013]". Illegal path attribute "/nexus". Path of origin:
>"/maven2/org/netbeans/cluster/platform/SNAPSHOT/maven-metadata.xml"

this is an error in proxying filed against nb.org instrastructure team, no idea when it will be resolved. The current workaround is to declare http://bits.netbeans.org/nexus/content/groups/netbeans/ instead of the bits.n.o/maven2 repository.
Comment 3 mdobacz 2013-04-19 09:29:05 UTC
Thanks for the answer!

(In reply to comment #2)
> have you tried creating the same application with SNAPSHOT repository
> initially? in wizard, without manual edits.

Yes. With SNAPSHOT initially and without manual edits it almost builds. Almost = there is some cryptic failure from the auto-generated ApplicationTest class, which I did not investige. After this test is removed the projest builds and runs ok though.

But the project is again generated using plugin v. 3.8. That has always worked for me.

When plugin version is changed to 3.9 (this time around this is the only manual change in poms), the build fails same way as above.

> have you tried running the build with -U (update snapshots?)

Yes.

> The current non-standard thing with nb.org snapshots currently is that we don't
> keep history of snapshots. the RE guy just builds the snapshot repo on a build
> server, zips it, scp to bits.n.o and replace the old directory. Therefore the
> maven local caches could get confused.

I get the same problem after temporarily mv'ing .m2/repostitory to something else.

> >WARNING: Cookie rejected: "[version: 0][name: rememberMe][value:
> >deleteMe][domain: bits.netbeans.org][path: /nexus][expiry: Fri Apr 19 11:12:29
> >EEST 2013]". Illegal path attribute "/nexus". Path of origin:
> >"/maven2/org/netbeans/cluster/platform/SNAPSHOT/maven-metadata.xml"
> 
> this is an error in proxying filed against nb.org instrastructure team, no idea
> when it will be resolved. The current workaround is to declare
> http://bits.netbeans.org/nexus/content/groups/netbeans/ instead of the
> bits.n.o/maven2 repository.

Thanks, that removes the warnings.

Is there any practically significant difference between plugin v. 3.8 and 3.9? In particular any difference about using the org-netbeans-modules-apisupport-harness artifact? Thing is I was originally hoping to test a recent change in the harness (I think - https://netbeans.org/bugzilla/show_bug.cgi?id=208749). It seems when one uses 3.8 plugin the harness module is not even downloaded, so that made me wonder.

Could I ask you one more general question here? If a bug contains a message from Quality like "Integrated into 'main-golden', will be available in build *201304172301*" - can one automatically assume that the same change will always be in the maven SNAPSHOT built on the following night (the 18th) in this case?
Comment 4 Milos Kleint 2013-04-24 07:56:57 UTC
I can workaround the problem by declaring a dependency on org-netbeans-modules-apisupport-harness in the application.

The problem is that if the harness module is missing then we attempt to guess the version based on the version of other basic modules and download it, however in case of snapshots it seems that each artifact /module in the repository has unique timestamp. I would say that's the root of the problem. however it will require some more investigation to figure out what we are doing from with the maven's ArtifactDeployer. Or if thats the default behaviour.
Comment 5 Milos Kleint 2013-04-24 12:14:31 UTC
I think part of the problem is that we generate a SNAPSHOT version instead of 7.3-SNAPSHOT for example. o.a.m.a.Artifact.VERSION_FILE_PATTERN Pattern assumes there is (.*)- before the timestamp.

that's something we talked about earlier in the dev team and this issue is a directly related to the problem. I've tried various approaches to recognizing the timestamp version but so far without positive results.
Comment 6 mdobacz 2013-04-24 13:43:31 UTC
Going off on a tangent a bit perhaps, but I'm wondering if it is generally a good idea / accepted practice for a plugin to resolve and download some de-facto dependency, which is not declared in poms of the project or its dependencies?

One side-effect this apparently has is that running goals such as dependency:list or dependency:resolve-plugins does not produce any mention of this harness artifact participating in the build.
Comment 7 Milos Kleint 2013-04-24 13:51:36 UTC
(In reply to comment #6)
> Going off on a tangent a bit perhaps, but I'm wondering if it is generally a
> good idea / accepted practice for a plugin to resolve and download some
> de-facto dependency, which is not declared in poms of the project or its
> dependencies?
> 
> One side-effect this apparently has is that running goals such as
> dependency:list or dependency:resolve-plugins does not produce any mention of
> this harness artifact participating in the build.

well, it's just a fallback if you don't declare it yourself. Please note that you don't need the entire harness module in the application (or maybe not at all), all we care about are the launchers. And basically it's always better to have launchers that belong to your own version of netbeans, rather than those that belong to some arbitrary version of netbeans that we wrapped up as part of the plugin (that used be the solution some time back).
Comment 8 Milos Kleint 2013-04-24 13:58:24 UTC
pgebauer, anebuzelsky: when I declare dev-SNAPSHOT to be the generated version of the generated maven repository artifacts, *all* of them share the same timestamp and the problem described in this issue disappears. Maybe it's time we switch to dev-SNAPSHOT in the official snapshot binaries as well.

ideally we would do so by uploading directly to nexus and let nexus handle the number of snapshots that should be preserved on site. But I know the limitations we have in terms of size/bandwidth/time, so  doing at least the rename from SNAPSHOT to dev-SNAPSHOT should help even with the current process.
Comment 9 Milos Kleint 2013-04-24 14:16:57 UTC
(In reply to comment #8)
> pgebauer, anebuzelsky: when I declare dev-SNAPSHOT to be the generated version
> of the generated maven repository artifacts, *all* of them share the same
> timestamp and the problem described in this issue disappears. 

Correction, it only appeared so from the build output as many artifacts were build around the same time. And it worked for me because I had my local modifications in my local repo, with stock 3.10-SNAPSHOT nbm-maven-plugin it still doesn't work

BUT

even if dev-SNAPSHOT does *not* fix the problem by itself, with that value in place maven
starts behaving sanely and I can fix it in the plugin. I guess it's safe to
push the changes to nbm-maven-plugin even before we use dev-SNAPSHOT as it
doesn't deteriorate the current (broken) behaviour but will start working once
we migrate our repository.
Comment 10 Milos Kleint 2013-04-26 06:35:32 UTC
I've created nbm-maven-plugin issue for the plugin changes part. http://jira.codehaus.org/browse/MNBMODULE-213

this issue remains to make sure we change the versioning of snapshots from SNAPSHOT to dev-SNAPSHOT..
Comment 11 Jesse Glick 2013-04-30 12:43:38 UTC
(In reply to comment #10)
> this issue remains to make sure we change the versioning of snapshots from
> SNAPSHOT to dev-SNAPSHOT..

Is this not already filed in www/repositories?
Comment 12 Milos Kleint 2013-04-30 12:50:27 UTC
indeed, I've completely forgotten about it. issue 210438
Comment 13 Milos Kleint 2013-06-07 13:49:37 UTC
http://hg.netbeans.org/core-main/rev/d1159f4ef277

nb wizard updated to use dev-SNAPSHOT and inject the new snapshot repository
Comment 14 Quality Engineering 2013-06-08 01:10:45 UTC
Integrated into 'main-golden', will be available in build *201306072301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/d1159f4ef277
User: Milos Kleint <mkleint@netbeans.org>
Log: #228747  switch from SNAPSHOT to dev-SNAPSHOT  and new snapshot repository