Search code examples
javamavendependenciesmaven-3skin

Enforcing a Maven skin dependency


I would like to use the Fluido skin for my Maven-based project. If I add it only in src/site/site.xml the mvn site fails because the artifact is missing. It ask to manually install the artifact, but I would like to avoid that step for my colleagues.

I've added the following dependency to my pom.xml:

<dependency>
  <groupId>org.apache.maven.skins</groupId>
  <artifactId>maven-fluido-skin</artifactId>
  <version>1.2.2</version>
</dependency>

And it seems to work: the skin is automatically downloaded by maven when I do mvn site. However I do not want that my project be marked as a dependency of that artifact ; I don't want that package to be in the classpath during compile, test, etc.

I don't see any dependency scope that would restrict the dependency just for site:site.

Did I miss something about dependency scope? Is using dependency for that relationship the right thing?


Solution

  • I do not have time to try this myself, but I think the following should work:

    <project>
      ...
      <build>
        <plugins>
          ...
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <dependencies>
              <dependency>
                <groupId>org.apache.maven.skins</groupId>
                <artifactId>maven-fluido-skin</artifactId>
                <version>1.2.2</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
      ...
    </project>