Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 214395 - [72cat] TestNG wizard for Maven projects changes dependency version and generates not compilable code
[72cat] TestNG wizard for Maven projects changes dependency version and gener...
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: TestNG
7.2
PC Windows 7 x64
: P1 (vote)
: 7.2
Assigned To: Theofanis Oikonomou
issues@java
:
: 211364 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-18 17:44 UTC by crazyjavahacking
Modified: 2012-06-24 21:04 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
Maven based TestNG project to test (3.47 KB, application/zip)
2012-06-18 17:44 UTC, crazyjavahacking
Details
proposed fix (2.30 KB, patch)
2012-06-18 21:07 UTC, Lukas Jungmann
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description crazyjavahacking 2012-06-18 17:44:18 UTC
Created attachment 121003 [details]
Maven based TestNG project to test

I just found very weird bug under certain circumstances.

TestNG wizard for Maven projects changes the dependency version of TestNG !!! and generates not compilable code !!!

To reproduce:
1.) !!! Remove all TestNG dependencies from local Maven repository (org.testng groupId)
=> without this step you will not be able to reproduce it

2.) Open attached Maven project
=> note that dependency version of TestNG is 6.5.1 and the project is compilable (dependencies will be downloaded during first compilation)
=> so far so good

3.) Click on source package and Tools->Create Tests and choose TestNG (all checkboxes should be checked)
=> The dependency will be changed to 6.5.2 ???
=> The tests will not be compilable, because multiple methods with the same name will be generated (one with short and one with fully qualified name).

- the weird thing is the fact that as soon as you will download the TestNG 6.5.2 dependency (it will be located in local Maven repository) this will work correctly for both 6.5.1 and 6.5.2 TestNG dependency version
- as soon as you will remove the 6.5.2 dependency, it will happen again


Affects both NetBeans 7.2 RC1 and NetBeans Dev 201206180001

JDK 7u5 32bit


I think this is really a NetBeans 7.2 stopper because the first time programmer will generate TestNG tests for Maven project, it will be very ugly experience
Comment 1 Lukas Jungmann 2012-06-18 21:07:10 UTC
Created attachment 121009 [details]
proposed fix

attached possible fix for this issue, Theo - check, review and possibly apply it, please.

Thanks!
Comment 2 Theofanis Oikonomou 2012-06-19 15:46:41 UTC
Thank you Lukas. Your patch takes care of not changing the dependency. Additionally I also download the artifacts. Now code is compilable. Fixed: http://hg.netbeans.org/core-main/rev/f7b9b063d0d6

Please verify. Thank you
Comment 3 Quality Engineering 2012-06-20 04:38:58 UTC
Integrated into 'main-golden', will be available in build *201206200001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/f7b9b063d0d6
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Issue #214395 - [72cat] TestNG wizard for Maven projects changes dependency version and generates not compilable code
Comment 4 crazyjavahacking 2012-06-20 08:53:45 UTC
Verified in today build NetBeans Dev 201206200001.

Just a small note. Before the dependency is in the local repository, the annotations will have fully qualified names (no imports). After the TestNG library is in local repository, imports will be used.
Comment 5 Theofanis Oikonomou 2012-06-20 11:19:00 UTC
Thank you for verifying. When the dependency is not locally present then the annotation use the FQN because the classes cannot be resolved. I believe this is expected though. I will integrate shortly.
Comment 6 Theofanis Oikonomou 2012-06-20 11:25:43 UTC
Integrated into release72 branch: http://hg.netbeans.org/releases/rev/52036fd5626e
Comment 7 Theofanis Oikonomou 2012-06-20 11:31:07 UTC
*** Bug 211364 has been marked as a duplicate of this bug. ***
Comment 8 Quality Engineering 2012-06-21 02:23:41 UTC
Integrated into 'releases', will be available in build *201206202200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/52036fd5626e
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Issue #214395 - [72cat] TestNG wizard for Maven projects changes dependency version and generates not compilable code
(transplanted from f7b9b063d0d63a6c4f336d3296a5f823b5fe5185)
Comment 9 Marian Mirilovic 2012-06-24 21:04:10 UTC
... pending verification in NB 7.2


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo