Hi Paul

I write test automation and try to stick to a solid design. I find others
break solid design principles so having a <main> scope will prevent people
from breaking some basic principles.

For example, if using Selenium I've seen multiple people expose WebElement
in a public method (that should be a private implementation detail). This
is just an example of horrible implementation I've seen multiple people do
without thinking. The new <main> scope will not prevent that however it
will prevent the following.

I've seen people create src/tst/java/helloworld/MyTest.java which accesses
a WebElement directly in their Junit / TestNG class. The new <main> scope
will prevent stuff like that from happening. What they should really do is
create src/main/java/helloworld/MyPage.java which implements the
functionality using WebElement, then get an instance of MyPage from their
src/tst/java/helloworld/MyTest.java.

That is just one obvious example but I've seen other poor implementations
using other dependencies which are as obvious what is good vs bad design
unless this principle is understood.

Scott



On Wed, Jan 22, 2020 at 11:43 PM Karl Heinz Marbaise <khmarba...@gmx.de>
wrote:

> Hi,
>
> On 23.01.20 00:59, Scott Wilson 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*
>
> This would result in the problem that you neever can run / compile your
> unit- and integration tests cause something is missing on the classpath
> so in result your project would be unusable...
>
>
>
> >
> >
> > *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.
>
> It would be great if you could shared this with us
>
>
> Kind regards
> Karl Heinz Marbaise
>
>
> >
> >
> > *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>*
> >
>

Reply via email to