You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Ty Young <yo...@gmail.com> on 2020/05/21 14:30:58 UTC

How do you setup JUnit with Maven?

Hi,


Can anyone tell me how to setup Maven with Netbeans? I've tried multiple 
times and the result is always the same: it tries to test but doesn't 
seem to be able to find them and doesn't do anything.


I'm guessing I need to override the default package name JUnit uses to 
look for classes to run, but I'm not sure where that is.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: How do you setup JUnit with Maven?

Posted by Ty Young <yo...@gmail.com>.
On 5/21/20 11:49 AM, John Mc wrote:
> What version of JUnit are you using?
>
> If its JUnit 5, then you need to be running the Maven Surefire plugin 
> > version 2.22
>
> See 
> https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html. 
> Note this is referencing the latest version
>
> Also JUnit has a sample project for JUnit 5 and maven: 
> https://github.com/junit-team/junit5-samples/tree/master/junit5-jupiter-starter-maven


I'm getting an error with surefire 2.22.1:


Unsupported class file major version 59


So I guess I can't use jUnit with JDK 15?


>
> Regards
>
> John
>
> On Thu, 21 May 2020 at 16:53, Ty Young <youngty1997@gmail.com 
> <ma...@gmail.com>> wrote:
>
>
>     On 5/21/20 10:07 AM, Luff,Chris wrote:
>     > No, nothing like that should be needed. Make sure your source
>     packages are mirrored in the test sources. Prefix your classes
>     with Test. Maven should run them fine.
>
>
>     To be clear, a test package must be 1:1 to be seen by Maven? For
>     example:
>
>
>     Source com.foo.bar
>
>
>     Test: com.foo.bar
>
>
>     ?
>
>
>     And the tests class must be called "TestBar.java"?
>
>
>     >
>     >
>     >
>     >> On 21 May 2020, at 15:30, Ty Young <youngty1997@gmail.com
>     <ma...@gmail.com>> wrote:
>     >>
>     >> Hi,
>     >>
>     >>
>     >> Can anyone tell me how to setup Maven with Netbeans? I've tried
>     multiple times and the result is always the same: it tries to test
>     but doesn't seem to be able to find them and doesn't do anything.
>     >>
>     >>
>     >> I'm guessing I need to override the default package name JUnit
>     uses to look for classes to run, but I'm not sure where that is.
>     >>
>     >>
>     >>
>     ---------------------------------------------------------------------
>     >> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>     <ma...@netbeans.apache.org>
>     >> For additional commands, e-mail: users-help@netbeans.apache.org
>     <ma...@netbeans.apache.org>
>     >>
>     >> For further information about the NetBeans mailing lists, visit:
>     >>
>     https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisplay%2FNETBEANS%2FMailing%2Blists&amp;data=02%7C01%7CChris.Luff%40cerner.com%7Cedddf29ac5ef4d6312d408d7fd93a0a5%7Cfbc493a80d244454a815f4ca58e8c09d%7C0%7C0%7C637256682807874580&amp;sdata=Z8J%2FjPHzPGi76mwCvCegEFOF3BcfPin2Npdg%2BPSML7A%3D&amp;reserved=0
>     >>
>     >
>     >
>     > CONFIDENTIALITY NOTICE This message and any included attachments
>     are from Cerner Corporation and are intended only for the
>     addressee. The information contained in this message is
>     confidential and may constitute inside or non-public information
>     under international, federal, or state securities laws.
>     Unauthorized forwarding, printing, copying, distribution, or use
>     of such information is strictly prohibited and may be unlawful. If
>     you are not the addressee, please promptly delete this message and
>     notify the sender of the delivery error by e-mail or you may call
>     Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1)
>     (816)221-1024. Cerner Limited, Registered in England no 2519305,
>     Registered Office 37 North Wharf Road, London W2 1AF.
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>     <ma...@netbeans.apache.org>
>     For additional commands, e-mail: users-help@netbeans.apache.org
>     <ma...@netbeans.apache.org>
>
>     For further information about the NetBeans mailing lists, visit:
>     https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>

Re: How do you setup JUnit with Maven?

Posted by John Mc <mc...@gmail.com>.
What version of JUnit are you using?

If its JUnit 5, then you need to be running the Maven Surefire plugin >
version 2.22

See
https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html.
Note this is referencing the latest version

Also JUnit has a sample project for JUnit 5 and maven:
https://github.com/junit-team/junit5-samples/tree/master/junit5-jupiter-starter-maven

Regards

John

On Thu, 21 May 2020 at 16:53, Ty Young <yo...@gmail.com> wrote:

>
> On 5/21/20 10:07 AM, Luff,Chris wrote:
> > No, nothing like that should be needed. Make sure your source packages
> are mirrored in the test sources. Prefix your classes with Test. Maven
> should run them fine.
>
>
> To be clear, a test package must be 1:1 to be seen by Maven? For example:
>
>
> Source com.foo.bar
>
>
> Test: com.foo.bar
>
>
> ?
>
>
> And the tests class must be called "TestBar.java"?
>
>
> >
> >
> >
> >> On 21 May 2020, at 15:30, Ty Young <yo...@gmail.com> wrote:
> >>
> >> Hi,
> >>
> >>
> >> Can anyone tell me how to setup Maven with Netbeans? I've tried
> multiple times and the result is always the same: it tries to test but
> doesn't seem to be able to find them and doesn't do anything.
> >>
> >>
> >> I'm guessing I need to override the default package name JUnit uses to
> look for classes to run, but I'm not sure where that is.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> >> For additional commands, e-mail: users-help@netbeans.apache.org
> >>
> >> For further information about the NetBeans mailing lists, visit:
> >>
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisplay%2FNETBEANS%2FMailing%2Blists&amp;data=02%7C01%7CChris.Luff%40cerner.com%7Cedddf29ac5ef4d6312d408d7fd93a0a5%7Cfbc493a80d244454a815f4ca58e8c09d%7C0%7C0%7C637256682807874580&amp;sdata=Z8J%2FjPHzPGi76mwCvCegEFOF3BcfPin2Npdg%2BPSML7A%3D&amp;reserved=0
> >>
> >
> >
> > CONFIDENTIALITY NOTICE This message and any included attachments are
> from Cerner Corporation and are intended only for the addressee. The
> information contained in this message is confidential and may constitute
> inside or non-public information under international, federal, or state
> securities laws. Unauthorized forwarding, printing, copying, distribution,
> or use of such information is strictly prohibited and may be unlawful. If
> you are not the addressee, please promptly delete this message and notify
> the sender of the delivery error by e-mail or you may call Cerner's
> corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
> Cerner Limited, Registered in England no 2519305, Registered Office 37
> North Wharf Road, London W2 1AF.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

Re: How do you setup JUnit with Maven?

Posted by Ty Young <yo...@gmail.com>.
On 5/21/20 10:07 AM, Luff,Chris wrote:
> No, nothing like that should be needed. Make sure your source packages are mirrored in the test sources. Prefix your classes with Test. Maven should run them fine.


To be clear, a test package must be 1:1 to be seen by Maven? For example:


Source com.foo.bar


Test: com.foo.bar


?


And the tests class must be called "TestBar.java"?


>
>
>
>> On 21 May 2020, at 15:30, Ty Young <yo...@gmail.com> wrote:
>>
>> Hi,
>>
>>
>> Can anyone tell me how to setup Maven with Netbeans? I've tried multiple times and the result is always the same: it tries to test but doesn't seem to be able to find them and doesn't do anything.
>>
>>
>> I'm guessing I need to override the default package name JUnit uses to look for classes to run, but I'm not sure where that is.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail: users-help@netbeans.apache.org
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisplay%2FNETBEANS%2FMailing%2Blists&amp;data=02%7C01%7CChris.Luff%40cerner.com%7Cedddf29ac5ef4d6312d408d7fd93a0a5%7Cfbc493a80d244454a815f4ca58e8c09d%7C0%7C0%7C637256682807874580&amp;sdata=Z8J%2FjPHzPGi76mwCvCegEFOF3BcfPin2Npdg%2BPSML7A%3D&amp;reserved=0
>>
>
>
> CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. Cerner Limited, Registered in England no 2519305, Registered Office 37 North Wharf Road, London W2 1AF.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: How do you setup JUnit with Maven?

Posted by "Luff,Chris" <Ch...@Cerner.com.INVALID>.
No, nothing like that should be needed. Make sure your source packages are mirrored in the test sources. Prefix your classes with Test. Maven should run them fine.



> On 21 May 2020, at 15:30, Ty Young <yo...@gmail.com> wrote:
>
> Hi,
>
>
> Can anyone tell me how to setup Maven with Netbeans? I've tried multiple times and the result is always the same: it tries to test but doesn't seem to be able to find them and doesn't do anything.
>
>
> I'm guessing I need to override the default package name JUnit uses to look for classes to run, but I'm not sure where that is.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisplay%2FNETBEANS%2FMailing%2Blists&amp;data=02%7C01%7CChris.Luff%40cerner.com%7Cedddf29ac5ef4d6312d408d7fd93a0a5%7Cfbc493a80d244454a815f4ca58e8c09d%7C0%7C0%7C637256682807874580&amp;sdata=Z8J%2FjPHzPGi76mwCvCegEFOF3BcfPin2Npdg%2BPSML7A%3D&amp;reserved=0
>



CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024. Cerner Limited, Registered in England no 2519305, Registered Office 37 North Wharf Road, London W2 1AF.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists