6

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.

daprog
  • 135
  • 1
  • 2
  • 8
  • I would assume your problem is located based on this: `Connection to http://maven.eclipse.org refused`. – khmarbaise May 12 '14 at 17:24
  • 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 May 13 '14 at 13:35
  • I came across this error today. The solution was to remove a dummy ... 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 Mar 13 '18 at 08:42

6 Answers6

3

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.

palek
  • 150
  • 6
2

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.

ltfishie
  • 2,917
  • 6
  • 41
  • 68
  • Thanks for your help, it worked for me after small changes - i had to add this file as PARENTPOM-VERSION-site_en.xml in my local repo. – daprog May 23 '14 at 12:26
  • 2
    This answer does not work for me. Although I was able to eventually resolve the parent POM's (empty) site_en.xml, I'm now stuck because the plugin is trying to resolve the site descriptor for the grandparent POM, which I don't control. I just want to generate a site without having to consult parent POMs. – Lyle Dec 02 '14 at 23:09
0

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

Frischling
  • 2,100
  • 14
  • 34
  • Same thing happened to me... It seems to be looking for the parent descriptor in the remote repos before trying the local m2! – eduyayo Nov 04 '19 at 09:50
0

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.

Brent Writes Code
  • 19,075
  • 7
  • 52
  • 56
0

The previous answers didn't work for me.

But Mark's one, here, solved the issue I had: https://stackoverflow.com/a/57429991/5056068

Etienne

etienne-sf
  • 131
  • 1
  • 7
0

I met the error like below, and I think it's because of checking parent project site xml either.

However I think org.springframework.boot:spring-boot-starter-parent:xml:site_en:2.7.4 is mvn site splicing from parent project like spring-boot-starter-parent and version 2.7.4 and default language en, so the mvn repostiory wouldn't found this xml forever.

And refer to last two answer, you can use mvn --offline site to generate a empty xml in your local repository.

The first mvn --offline site would return the same error and generate the xml.

Then you can use mvn site free to avoid checking parent project.

SiteToolException: The site descriptor cannot be resolved from the repository: ArtifactResolutionException: Una
ble to locate site descriptor: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:xml:site_en:2.7.4
Harutya
  • 3
  • 2