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 190149 - Action wizard generates code for 6.10 when running with maven dep RELEASE691
Summary: Action wizard generates code for 6.10 when running with maven dep RELEASE691
Status: RESOLVED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0
Hardware: All All
: P2 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
: 190971 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-09-04 17:52 UTC by Jaroslav Tulach
Modified: 2010-10-25 15:03 UTC (History)
1 user (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 Jaroslav Tulach 2010-09-04 17:52:20 UTC
I have maven netbeans application project where I depend on platform cluster in version RELEASE691. To my surprise, when I use the action wizard I get the new @annotation version.

@ActionID(category = "Edit",
id = "cz.xelfi.quoridor.desktop.sample.Hello")
@ActionRegistration(displayName = "#CTL_Hello")
@ActionReferences({
    @ActionReference(path = "Menu/File", position = 1300)
})
public final class Hello implements ActionListener {
onPerformed(ActionEvent e) {
        // TODO implement action body
    }
}

The wizard's code properly checks whether platform dependency is higher 7.28, so there must be something in the maven what gets confused and reports inproper version of openide.awt module being available.
Comment 1 Jesse Glick 2010-09-20 21:40:47 UTC
Improved in core-main #866eef548f80 to at least work if you already have the dep on org.netbeans.api:org-openide-awt in your POM. (MavenProject.getDependencyArtifacts just seems to return null now in M3, for no clear reason. As usual, Javadoc makes no mention of this possibility.)

Making it work if the dep is not yet there will be trickier. Impossible if you have *no* deps on some NB API, which is why the archetype includes an initial dep on org.openide.util. MavenNbModuleImpl.addDependency does try to look for "sibling" dependencies and copy the same version, and getDependencyVersion could probably use the same trick.
Comment 2 Quality Engineering 2010-09-22 03:08:20 UTC
Integrated into 'main-golden', will be available in build *201009220000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/866eef548f80
User: Jesse Glick <jglick@netbeans.org>
Log: #190149 (partial): getDependencyVersion was always returning null in platform app modules.
Comment 3 Jesse Glick 2010-10-13 16:01:05 UTC
*** Bug 190971 has been marked as a duplicate of this bug. ***
Comment 4 Jesse Glick 2010-10-15 13:48:19 UTC
Pretty visible, needs to be fixed even if easy to work around.
Comment 5 Jesse Glick 2010-10-20 18:49:52 UTC
Ideally would be tested by something like this:

    public void testGetDependencyVersion() throws Exception {
        TestFileUtils.writeFile(wd, "pom.xml", "<project><modelVersion>4.0.0</modelVersion>"
                + "<groupId>test</groupId><artifactId>prj</artifactId>"
                + "<packaging>nbm</packaging><version>1.0</version>"
                + "<build><plugins><plugin><groupId>org.codehaus.mojo</groupId><artifactId>nbm-maven-plugin</artifactId><extensions>true</extensions></plugin></plugins></build>"
                + "<dependencies><dependency><groupId>org.netbeans.api</groupId><artifactId>org-netbeans-api-annotations-common</artifactId><version>RELEASE691</version></dependency></dependencies>"
                + "</project>");
        Project p = ProjectManager.getDefault().findProject(wd);
        assertNotNull(p);
        NbModuleProvider nbmp = p.getLookup().lookup(NbModuleProvider.class);
        assertNotNull(nbmp);
        assertEquals("8.3.1", String.valueOf(nbmp.getDependencyVersion("org.openide.util.lookup")));
    }

However this requires various artifacts to be present in the local repo, and the repository index to be current - probably out of range of a unit test.
Comment 6 Jesse Glick 2010-10-20 19:08:05 UTC
core-main #195d6ed8c9ca
Comment 7 Quality Engineering 2010-10-25 15:03:36 UTC
Integrated into 'main-golden', will be available in build *201010251131* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/195d6ed8c9ca
User: Jesse Glick <jglick@netbeans.org>
Log: #190149: Action wizard generates code for 6.10 when running with maven dep RELEASE691