Multimodule using scalastyle maven plugin

416 views
Skip to first unread message

Luis Ramirez

unread,
Jul 17, 2013, 6:48:02 PM7/17/13
to scalasty...@googlegroups.com
I am trying to configure my project. Has a root project and two modules.

problem is with configLocation a file has to exist in each submodule, I am trying to avoid duplication

My configuration is 

<configLocation>${project.basedir}/src/main/resources/scalastyle_config.xml</configLocation>

With checkstyle this is posible

<configLocation>scalastyle_config.xml</configLocation>

because tries to use a resource, but ScalastyleViolationCheckMojo only relies on files

if (!new File(configLocation).exists()) {
    throw new MojoFailureException("configLocation " + configLocation + " does not exist");
}

are there any workarounds?

Matthew Farwell

unread,
Jul 18, 2013, 4:17:27 AM7/18/13
to scalasty...@googlegroups.com
You're right that the multi-module configuration isn't great. You can always specify a path which contains a relative part:

      <configLocation>${basedir}/../lib/scalastyle_config.xml</configLocation>

Matthew Farwell.


2013/7/18 Luis Ramirez <lnra...@gmail.com>

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes Scalastyle users.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse scalastyle-use...@googlegroups.com.
Pour envoyer un message à ce groupe, adressez un e-mail à scalasty...@googlegroups.com.
Visitez ce groupe à l'adresse http://groups.google.com/group/scalastyle-users .
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .
 
 

Tomer Ben David

unread,
Jan 8, 2014, 12:18:53 PM1/8/14
to scalasty...@googlegroups.com
hmm, but why do i need the xml, i would expect i should be able to simply put the plugin in my maven xml and have it working perhaps, perhaps the plugin should contain a default version of the style the latest one.  what do you say?

Matthew Farwell

unread,
Jan 19, 2014, 5:27:48 AM1/19/14
to scalasty...@googlegroups.com
There was a PR done recently: https://github.com/scalastyle/scalastyle-maven-plugin/commit/0a351d625d6dd041bab52b5d1bf2148bb08f5aa5 : enhanced configuration file resolution

This allows you to specify a URL or a classpath resource (which means you can have a dependency) Can you try your code with the latest build (0.3.3-SNAPSHOT) and see if this is what you need?

Thanks.

Matthew Farwell.


2014/1/8 Tomer Ben David <tome...@gmail.com>

Christoph Dittberner

unread,
Feb 21, 2014, 1:10:14 PM2/21/14
to scalasty...@googlegroups.com
I'm using 0.4.0 and it doesn't work for me.  I have a root project which defines the scalastyle-plugin in the build section. After that there is a base project which contains the scalastyle config in its resources. Up to here all works well. Now I have the first real scala project ... and scalastyle fails complaining about missing config. Looking into the PR I think the plugin only looks for a config in the classpath of current active project and not in its dependencies, isn't it?

Thanks.

Christoph Dittberner

Matthew Farwell

unread,
Feb 22, 2014, 5:52:49 PM2/22/14
to scalasty...@googlegroups.com
Yes, the maven plugin doesn't take into account the dependencies. This is easy enough to get working, do you want to raise an issue in github or even better submit a PR?

Thanks.

Matthew Farwell.


Reply all
Reply to author
Forward
0 new messages