thanks ossi

my problem is not that checkstyle doesn't find the configuration.
i have my configuration in a dependency in a jar in my repository.
it is found and simple submodules are checkstyled fine.


it's just that checkstyle does not find dependencies on submodules in
the same project.
it is only resolving dependencies that are in the repository, not the
ones that are
in the current project.


when i copy the example from

http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/multi-module-config.html

checkstyle does not even find the checkstyle.xml configuration, as it
can not resolve
the dependency in the same project and only searches for the
build-tools module in the repository.

here is what happens:

$ mvn checkstyle:checkstyle

[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO]   WhizBang Parent
[INFO]   Unnamed - com.example.whizbang:build-tools:jar:1.0
[INFO]   Unnamed - com.example.whizbang:subProj1:jar:1.0
[INFO]   Unnamed - com.example.whizbang:subProj2:jar:1.0
[INFO] Searching repository for plugin with prefix: 'checkstyle'.
[INFO] ------------------------------------------------------------------------
[INFO] Building WhizBang Parent
[INFO]    task-segment: [checkstyle:checkstyle]
[INFO] ------------------------------------------------------------------------
Downloading: 
http://myServer.homelinux.net:8081/artifactory/repo/com/example/whizbang/build-tools/1.0/build-tools-1.0.jar
Downloading: 
http://myServer.homelinux.net:8081/artifactory/repo/com/example/whizbang/build-tools/1.0/build-tools-1.0.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.example.whizbang:build-tools:jar:1.0

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=com.example.whizbang
-DartifactId=build-tools -Dversion=1.0 -Dpackaging=jar
-Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=com.example.whizbang
-DartifactId=build-tools -Dversion=1.0 -Dpackaging=jar
-Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) org.apache.maven.plugins:maven-checkstyle-plugin:maven-plugin:2.2
        2) com.example.whizbang:build-tools:jar:1.0

----------
1 required artifact is missing.

for artifact:
  org.apache.maven.plugins:maven-checkstyle-plugin:maven-plugin:2.2

from the specified remote repositories:
  apache.snapshots (http://people.apache.org/repo/m2-snapshot-repository),
  central (http://repo1.maven.org/maven2)


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Sat Feb 07 10:49:39 CET 2009
[INFO] Final Memory: 7M/80M
[INFO] ------------------------------------------------------------------------


so now checkstyle does not even find the submodule that holds the config.
again "mvn test" runs without problems.


when i leave out the custom checkstyle config and run checkstyle with
the default configuration
the same error appears.
subProj2 depends on subProj2 -> checkstyle tries to download subProj1
from rep -> fails..
here the output:

$ mvn checkstyle:checkstyle
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO]   WhizBang Parent
[INFO]   Unnamed - com.example.whizbang:build-tools:jar:1.0
[INFO]   Unnamed - com.example.whizbang:subProj1:jar:1.0
[INFO]   Unnamed - com.example.whizbang:subProj2:jar:1.0
...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.example.whizbang:subProj2:jar:1.0
[INFO]    task-segment: [checkstyle:checkstyle]
[INFO] ------------------------------------------------------------------------
Downloading: 
http://myServer.homelinux.net:8081/artifactory/repo/com/example/whizbang/subProj1/1.0/subProj1-1.0.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.example.whizbang:subProj1:jar:1.0
...



to me it seems like the checkstyle plugin can not handle intraproject
dependencies.

or what am i forgetting?

best, tim




> hallo
>
> the trick is to reference the checkstyle config as a dependency and not
> directly as a file.
>
> there are some hints at:
> http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/multi-module-config.html
>
> we created a module containing only the checkstyle config. the parent
> pom then gets this checkstyle-plugin configuration with a dependency to
> that artifact.
>
> that should work :)
> good luck
>
> regards
>
> ossi
>
>
>
>
> tim tim schrieb:
>
> > hello
> >
> > i have a simple multimodule project
> >
> > pom.xml
> > |
> > proj1---- pom.xml
> > |
> > proj2----pom.xml
> >
> > in the main pom.xml:
> > <modules>
> > <module>proj1<module>
> > <module>proj2<module>
> > <modules>
> >
> >
> > proj2 depends on proj1.
> >
> >    <dependency>
> > <groupId>myComp</groupId>
> > <artifactId>proj1</artifactId>
> > <version>0.1-SNAPSHOT</version>
> >    </dependency>
> >
> >
> > this dependency is resolved correctly when i call
> >
> > mvn test
> >
> > or when i open the projects via m2eclipse
> >
> > but when i call
> >
> > mvn checkstyle:checkstyle
> >
> > the checkstyle plugin creates correct reports for proj1
> >
> > but when it tries to work on proj2 i get the following error:
> >
> > [INFO] 
> > ------------------------------------------------------------------------
> > [ERROR] BUILD ERROR
> > [INFO] 
> > ------------------------------------------------------------------------
> > [INFO] Failed to resolve artifact.
> >
> > Missing:
> > ----------
> > 1) myComp:proj1:jar:0.1-SNAPSHOT
> >
> >
> > it tries to load the missing dependency from a repository instead of using 
> > the
> > files in the other submodule like the test and the compile plugins do.
> >
> > i can not imagine that i have to deploy all jars before i use checkstyle?
> >
> > how do i use checkstyle for multimodule projects?
> >
> >
> >
> > thanks, tim

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to