开发者

Maven multi-project dependency management for checkstyle plugin

I'm trying to use the maven-checkstyle plugin for a multi-module project here is my projec structure

|pom-root
| -- my-checkstyles
|      |-- pom.xml
|      |-- checkstyles
|            |-- checkstyles.xml
| -- my-war
|      |-- pom.xml
| -- my-ejb
|      |-- pom.xml
| -- my-ear
|      |-- pom.xml
| -- pom.xml

and here is the pom.xml for my pom-root project :

<project
xsi:schemaLocation=
     "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns=
    "http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   >
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>pom-root</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
    <module>my-checkstyles</module>
    <module>my-ear</module>
    <module>my-ejb</module>
    <module>my-war</module>
</modules>


<build>
   <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-resources-plugin</artifactId>
              <version>2.5</version>
              <configuration>
                   <encoding>UTF-8</encoding>
              </configuration>
          </plugin>

          <开发者_运维百科;plugin>
              <groupId>org.apache.maven.plugins </groupId>
              <artifactId> maven-site-plugin </artifactId>
              <version>3.0-beta-3</version>
              <dependencies>
                  <dependency>
                      <groupId>com.puppycrawl.tools</groupId>
                      <artifactId>checkstyle</artifactId>
                      <version>5.4</version>
                  </dependency>
                  <dependency>
                      <groupId>fr.info.saone</groupId>
                      <artifactId>info-saone-checkstyle</artifactId>
                      <version>0.0.1-SNAPSHOT</version>
                  </dependency>
              </dependencies>
              <configuration>
                  <outputEncoding>UTF-8</outputEncoding>

                  <reportPlugins>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-checkstyle-plugin</artifactId>
                          <version>2.7</version>
                          <configuration>
                              <cacheFile>target/cachefile</cacheFile>
                              <configLocation>checkstyles/checkstyle_vnf.xml</configLocation>                                
                              <linkXRef>true</linkXRef>
                          </configuration>
                      </plugin>
                  </reportPlugins>
              </configuration>
          </plugin>
   </plugins>

</build>
</project>

When I execute mvn site it fails unless I have the checkstyle project installed in the repository, which is pretty annoying because if a make a slight change in the file I need to install it again in the repo.

I know Maven is supposed to work this way, but is there a way to configure the root pom to resolve the dependency to the checkstyle project at compile time and not get it from the repo?

I tried using maven options "--also-make" and "-pl" but I couldn't get it working.

Also I know I can tell checkfile to look for the checkstyle file using the file:/// protocol (thats how I'm doing it now) but I would rather find an alternative way.

Thanks in advance

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜