How do you want to run tests? If the dependency is not in classpath of
running tests, but in classpath of main sources, then you just get an
NoClassDefFoundError, isn't it?

For me it looks like you need to put tests into another module,  make it
depend on main module and declare your third-party-dependency as provided.
(And provide it somehow, ofc)

On Thu, Jan 23, 2020 at 10:20 AM Paul Hammant <[email protected]>
wrote:

> I'm interested in your need for this. Like, why do you need this?
>
> On Thu, Jan 23, 2020 at 7:17 AM Scott Wilson <[email protected]> wrote:
>
> > *Hi Robert and devs*
> >
> >
> > *I have been using maven for a few years and I LOVE it!*
> >
> >
> > *I have a feature request.*
> >
> >
> > *(1) When adding a dependency to pom.xml the default scope is everywhere*
> >
> > *ie src/main/java/....*
> >
> > *and src/tst/java/...*
> >
> >
> > *(2) When adding <test> as the scope then the dependency can ONLY be used
> > under src/tst/java...*
> >
> > *If referencing the dependency in src/main/java/... then it will not
> > compile*
> >
> >
> > *(3) My feature request:*
> >
> > *I want the exact opposite. I'd like a new scope called <main>*
> >
> > *If the scope is <main> then the dependency can ONLY be used under
> > src/main/java/...*
> >
> > *If referencing the dependency in tst/main/java/.... then it will not
> > compile*
> >
> >
> > *I read up on scopes
> > (**
> >
> https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
> > <
> >
> https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
> > >)
> > *and
> > AFAIK this is not currently supported, but I have a specific reason for
> > wanting this.
> >
> >
> > *I'd really appreciate if someone can add that for me and let me know
> when
> > it's done.*
> >
> > *Please let me know if you have any questions.*
> >
> >
> > *Regards*
> >
> > *Scott Wilson*
> >
> > *http://linkedin.com/in/hockeyeh <http://linkedin.com/in/hockeyeh>*
> >
>


-- 
Alexander Bubenchikov
Software developer
JetBrains
http://www.jetbrains.com
The Drive to Develop

Reply via email to