Home » Modeling » TMF (Xtext) » [Xtext 2.3.0M7] org.hamcrest in the test plugin
| | | | | | | | | | |
Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #873004 is a reply to message #871458] |
Thu, 17 May 2012 09:41 |
|
Hi
I managed to solve the problem of building with tycho in the presence of
the generated dependencies on org.hamcrest as follows:
- in the tycho pom file I add this repository (so there's no need of
using the swtbot repository):
<repository>
<id>orbit</id>
<layout>p2</layout>
<url>http://download.eclipse.org/tools/orbit/downloads/drops/R20110523182458/repository/</url>
</repository>
- this however is not enough... I don't know whether it is a tycho
thing, but it cannot resolve org.hamcrest (and download it) if it is
just an imported package: I have to add org.hamcrest as a required
bundle in the MANIFEST.MF, thus
Require-Bundle: ...
org.eclipse.core.runtime,
org.eclipse.xtext.junit4,
org.junit4,
org.eclipse.ui.workbench;resolution:=optional,
org.eclipse.xtext.xbase.junit;bundle-version="2.3.0",
org.eclipse.xtext.xbase;bundle-version="2.3.0",
org.eclipse.jdt.core;bundle-version="3.7.3",
org.hamcrest <---------- MANUALLY ADDED
Import-Package: org.apache.commons.logging,
org.apache.log4j,
org.junit;version="4.5.0",
org.junit.runner;version="4.5.0",
org.junit.runner.manipulation;version="4.5.0",
org.junit.runner.notification;version="4.5.0",
org.junit.runners;version="4.5.0",
org.junit.runners.model;version="4.5.0",
org.hamcrest,
org.hamcrest.core
is this a bug? would it do harm to generate in the MANIFEST.MF of the
test plugin also org.hamcrest as required bundle (besides as an imported
package)?
cheers
Lorenzo
On 05/13/2012 11:06 PM, Lorenzo Bettini wrote:
> On 05/13/2012 10:35 PM, Sebastian Zarnekow wrote:
>> Am 13.05.12 17:42, schrieb Christian Dietrich:
>>> Hi,
>>>
>>> i guess this dep is redunant since junit4 already requires the bundle
>>> org.hamcrest.core. (so dont care)
>>>
>>> ~Christian
>>
>> It's a PDE thing. Transitive package imports are not properly resolved
>> if you launch a test as a plain JUnit test thus you have to import
>> harmcrest explicitly.
>>
>
> but who is using harmcrest internally? I'm asking because by removing
> that import the tests run anyway...
>
> if those imports are left in the MANIFEST, then building with tycho
> complains about not being able to resolve them...
>
> I managed to build the test plugin (importing harmcrest) with tycho only
> by adding swtbot (which I know provides harmcrest) in the p2
> repositories...
>
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #873450 is a reply to message #873004] |
Fri, 18 May 2012 09:03 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Lorenzo,
I think we fixed an issue in the unit test generator fragment that added
the package import for org.harmcrest by accident. Only
org.harmcrest.core is requrired (or the other way round - anyway, only
one of both imports was valid where the other one cause issues). Could
you please try with the latest nightlies?
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 17.05.12 11:41, schrieb Lorenzo Bettini:
> Hi
>
> I managed to solve the problem of building with tycho in the presence of
> the generated dependencies on org.hamcrest as follows:
>
> - in the tycho pom file I add this repository (so there's no need of
> using the swtbot repository):
>
> <repository>
> <id>orbit</id>
> <layout>p2</layout>
> <url>http://download.eclipse.org/tools/orbit/downloads/drops/R20110523182458/repository/</url>
>
> </repository>
>
> - this however is not enough... I don't know whether it is a tycho
> thing, but it cannot resolve org.hamcrest (and download it) if it is
> just an imported package: I have to add org.hamcrest as a required
> bundle in the MANIFEST.MF, thus
>
> Require-Bundle: ...
> org.eclipse.core.runtime,
> org.eclipse.xtext.junit4,
> org.junit4,
> org.eclipse.ui.workbench;resolution:=optional,
> org.eclipse.xtext.xbase.junit;bundle-version="2.3.0",
> org.eclipse.xtext.xbase;bundle-version="2.3.0",
> org.eclipse.jdt.core;bundle-version="3.7.3",
> org.hamcrest <---------- MANUALLY ADDED
> Import-Package: org.apache.commons.logging,
> org.apache.log4j,
> org.junit;version="4.5.0",
> org.junit.runner;version="4.5.0",
> org.junit.runner.manipulation;version="4.5.0",
> org.junit.runner.notification;version="4.5.0",
> org.junit.runners;version="4.5.0",
> org.junit.runners.model;version="4.5.0",
> org.hamcrest,
> org.hamcrest.core
>
> is this a bug? would it do harm to generate in the MANIFEST.MF of the
> test plugin also org.hamcrest as required bundle (besides as an imported
> package)?
>
> cheers
> Lorenzo
>
> On 05/13/2012 11:06 PM, Lorenzo Bettini wrote:
>> On 05/13/2012 10:35 PM, Sebastian Zarnekow wrote:
>>> Am 13.05.12 17:42, schrieb Christian Dietrich:
>>>> Hi,
>>>>
>>>> i guess this dep is redunant since junit4 already requires the bundle
>>>> org.hamcrest.core. (so dont care)
>>>>
>>>> ~Christian
>>>
>>> It's a PDE thing. Transitive package imports are not properly resolved
>>> if you launch a test as a plain JUnit test thus you have to import
>>> harmcrest explicitly.
>>>
>>
>> but who is using harmcrest internally? I'm asking because by removing
>> that import the tests run anyway...
>>
>> if those imports are left in the MANIFEST, then building with tycho
>> complains about not being able to resolve them...
>>
>> I managed to build the test plugin (importing harmcrest) with tycho only
>> by adding swtbot (which I know provides harmcrest) in the p2
>> repositories...
>>
>
>
|
|
|
Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #874238 is a reply to message #873450] |
Sun, 20 May 2012 08:32 |
|
On 05/18/2012 11:03 AM, Sebastian Zarnekow wrote:
> Hi Lorenzo,
>
> I think we fixed an issue in the unit test generator fragment that added
> the package import for org.harmcrest by accident. Only
> org.harmcrest.core is requrired (or the other way round - anyway, only
> one of both imports was valid where the other one cause issues). Could
> you please try with the latest nightlies?
Hi Sebastian
I tried
http://download.eclipse.org/modeling/tmf/xtext/updates/composite/latest/
i.e., 2.3.0.v201205191342 and I still get this MANIFEST.MF for the test
plugin, which shows the same problem (which, again, can be fixed by
adding org.hamcrest as a Require-Bundle and not just Import-Package):
Require-Bundle: org.xtext.example.mydsl,
org.xtext.example.mydsl.ui,
org.eclipse.core.runtime,
org.eclipse.xtext.junit4,
org.junit4,
org.eclipse.ui.workbench;resolution:=optional,
org.eclipse.xtext.xbase.junit;bundle-version="2.3.0",
org.eclipse.xtext.xbase;bundle-version="2.3.0",
org.eclipse.jdt.core;bundle-version="3.7.3"
Import-Package: org.apache.commons.logging,
org.apache.log4j,
org.junit;version="4.5.0",
org.junit.runner;version="4.5.0",
org.junit.runner.manipulation;version="4.5.0",
org.junit.runner.notification;version="4.5.0",
org.junit.runners;version="4.5.0",
org.junit.runners.model;version="4.5.0",
org.hamcrest,
org.hamcrest.core
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #874626 is a reply to message #874238] |
Mon, 21 May 2012 09:18 |
|
Lorenzo Bettini wrote on Sun, 20 May 2012 10:32On 05/18/2012 11:03 AM, Sebastian Zarnekow wrote:
I tried
http://download.eclipse.org/modeling/tmf/xtext/updates/composite/latest/
i.e., 2.3.0.v201205191342 and I still get this MANIFEST.MF for the test
plugin, which shows the same problem (which, again, can be fixed by
adding org.hamcrest as a Require-Bundle and not just Import-Package):
Hi Lorenzo,
this bug was fixed on 15.05, so your version v20120519 contains the fix already, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=379521
I've tried both wizard and generator with the most recent version 2.3.0.v201205201426 and all works as expected. Only the org.hamcrest.core package import is generated.
Best regards,
Dennis.
P.S.: You can't import org.hamcrest package because it's hidden/protected, see the bug report for more information.
+Dennis Huebner
Get professional support from the Xtext committers at www.typefox.io
[Updated on: Mon, 21 May 2012 09:19] Report message to a moderator
|
|
|
Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #874777 is a reply to message #874626] |
Mon, 21 May 2012 14:23 |
|
On 05/21/2012 11:18 AM, Dennis Huebner wrote:
> Lorenzo Bettini wrote on Sun, 20 May 2012 10:32
>> On 05/18/2012 11:03 AM, Sebastian Zarnekow wrote:
>> I tried
>>
>> http://download.eclipse.org/modeling/tmf/xtext/updates/composite/latest/
>>
>> i.e., 2.3.0.v201205191342 and I still get this MANIFEST.MF for the
>> test plugin, which shows the same problem (which, again, can be fixed
>> by adding org.hamcrest as a Require-Bundle and not just Import-Package):
>
>
> Hi Lorenzo,
> this bug was fixed on 15.05, so your version v20120519 contains the fix
> already, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=379521
> I've tried both wizard and generator with the most recent version
> 2.3.0.v201205201426 and all works as expected. Only the
> org.hamcrest.core package import is generated.
>
> Best regards,
> Dennis.
>
Hi Dennis
sorry I hadn't realized my workspace was using a target platform based
on xtext 2.3.0M7 so I wasn't actually using the latest generator :)
with the current 2.3.0.v201205210926 the generated MANIFEST.MF for the
test plugin is
Require-Bundle: org.xtext.example.mydsl,
org.xtext.example.mydsl.ui,
org.eclipse.core.runtime,
org.eclipse.xtext.junit4,
org.junit4,
org.eclipse.ui.workbench;resolution:=optional,
org.eclipse.xtext.xbase.junit;bundle-version="2.3.0",
org.eclipse.xtext.xbase;bundle-version="2.3.0",
org.eclipse.jdt.core;bundle-version="3.7.3"
Import-Package: org.apache.commons.logging,
org.apache.log4j,
org.junit.runner;version="4.5.0",
org.junit.runner.manipulation;version="4.5.0",
org.junit.runner.notification;version="4.5.0",
org.junit.runners;version="4.5.0",
org.junit.runners.model;version="4.5.0",
org.hamcrest.core
which keeps Tycho happy :)
thanks
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Goto Forum:
Current Time: Sat Apr 27 00:52:44 GMT 2024
Powered by FUDForum. Page generated in 0.04386 seconds
|