6
votes

I have small maven project. I'm trying to add generating site by maven-site-plugin, but it doesn't work. When I'm building this project i get following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project server-wms-product: SiteToolException: The site descriptor cannot be resolved from the repository: ArtifactResolutionException: Unable to locate site descriptor: Could not transfer artifact [PARENT-PROJECT]:xml:site_en:1.0.141.1 from/to eclipse (http://maven.eclipse.org/nexus/content/repositories/testing/): Connection to http://maven.eclipse.org refused

My project is extension for other project, so in my pom.xml is set parent project which isn't mine and I can't add site configuration there.

So is there any chance to skip checking parent project's site in site generation?

My pom.xml looks like this:

   <project>
       <parent>
        <artifactId>base-server-product</artifactId>
        <groupId>XXXXXXXXXXXx</groupId>
        <version>1.0</version>
    </parent>
        <build>
             <plugins>
                <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-site-plugin</artifactId>
                   <version>3.3</version>
                   <configuration>
                      <reportPlugins>
                      </reportPlugins>
                   </configuration>
                </plugin>
             </plugins>
       </build>
    </project>

And of course i have site.xml file in src/site.

4
I would assume your problem is located based on this: Connection to http://maven.eclipse.org refused. - khmarbaise
No, this error with maven.eclipse.org is shown only that maven searched my repository and didn't found parent project's site.xml (because it doesn't exist and never will be). After that maven is trying to lookup in other repositories. But it doesn't have any sense. Real issue is that in my project maven should't try to search partent's site.xml because it doesn't exits. - daprog
I came across this error today. The solution was to remove a dummy <scm><url>...</url></scm> entry which was copy pasted in the parent pom. It seems like maven site uses this url in a way when generating the site for the children. (This may help future reader, but I know it does not really answer the question as in that case @daprog has no access to the parent pom) - Francois Marot

4 Answers

2
votes

I have the exact same problem, and after much googling, came across this article which solved my problem:

http://amanica.blogspot.com/2010/08/archiva-gives-maven-site-plugin-invalid.html?m=1

Basically you want to add a basic site_en.xml to /src/site/ folder in your parent pom.xml.

3
votes

Configure attaching the site descriptor to the artifacts in the parent pom.

<project>
  <artifactId>base-server-product</artifactId>
  <groupId>XXXXXXXXXXXx</groupId>
  <version>1.0</version>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-site-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-descriptor</id>
            <goals>
              <goal>attach-descriptor</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  ...
</project>

Core functionality has been separated from site generation in maven 3. You can find the reasons here. If you want to refer to the parent module's site from the submodule, you have to attach the site.xml to the deployed artifacts.

0
votes

For a reason I can't fathom, with me, it was enough to run maven in offline mode once.

0
votes

I came across this question when working on an open source project I don't own where I wanted to submit an update to a site being generated in this manner. I wanted to test and view the change locally, but kept hitting this error.

User @Frischling alluded to this above (credit to them). It turns out what I wanted was not to edit any existing information or update any pom.xml files, but just build entirely in offline mode.

I was trying to run this command and it was failing with the error the original poster mentioned:

mvn site

To do this build offline instead, execute the following commands:

# Download the dependencies for the target
mvn dependency:go-offline site

# Build the target offline
mvn --offline site

Then the output got correctly generated to the target/site directory like I expected.

It's not ideal if you own the project or part of the project, but for a case like mine where I owned none of it, it was the perfect option.