3

During building a project with maven, I run into an issue generating javadoc after updating the version of its parent project.

2016-08-18 16:06:44.559 [INFO] <<< maven-javadoc-plugin:2.10.3:aggregate < generate-sources @ org.eclipse.scout.rt <<<
2016-08-18 16:06:44.560 [DEBUG] building maven31 dependency graph for org.eclipse.scout.rt:org.eclipse.scout.rt:pom:6.0.0-SNAPSHOT with Maven31DependencyGraphBuilder
2016-08-18 16:06:44.560 [DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=1, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=0, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=0, ConflictResolver.conflictItemCount=0, DefaultDependencyCollector.collectTime=0, DefaultDependencyCollector.transformTime=0}
2016-08-18 16:06:44.561 [DEBUG] org.eclipse.scout.rt:org.eclipse.scout.rt:pom:6.0.0-SNAPSHOT
2016-08-18 16:06:44.636 [DEBUG]  canGenerateReport = true for project MavenProject: org.eclipse.scout.rt:org.eclipse.scout.rt:6.0.0-SNAPSHOT @ /home/<REDACTED>/workspace/org.eclipse.scout.rt.branch-6.0_nightly-sitedocs/org.eclipse.scout.rt/pom.xml
2016-08-18 16:06:44.662 [DEBUG] Computing decoration model of org.eclipse.scout.rt:org.eclipse.scout.rt:pom:6.0.0-SNAPSHOT for locale en
2016-08-18 16:06:44.662 [DEBUG] No site descriptor found for org.eclipse.scout.rt:org.eclipse.scout.rt:pom:6.0.0-SNAPSHOT
2016-08-18 16:06:44.663 [DEBUG] Looking for site descriptor of level 1 parent project: org.eclipse.scout:maven_rt_plugin_config-master:pom:2.0.7
2016-08-18 16:06:44.665 [DEBUG] Using transporter WagonTransporter with priority -1.0 for <REDACTED>
2016-08-18 16:06:44.666 [DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for <REDACTED>
2016-08-18 16:06:44.666 [INFO] Downloading: <REDACTED>/org/eclipse/scout/maven_rt_plugin_config-master/2.0.7/maven_rt_plugin_config-master-2.0.7-site_en.xml
2016-08-18 16:06:45.289 [DEBUG] Writing tracking file /home/<REDACTED>/workspace/org.eclipse.scout.rt.branch-6.0_nightly-sitedocs/.repository/org/eclipse/scout/maven_rt_plugin_config-master/2.0.7/maven_rt_plugin_config-master-2.0.7-site_en.xml.lastUpdated
2016-08-18 16:06:45.597 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.5.1:site (default-cli) on project org.eclipse.scout.rt: SiteToolException: The site descriptor cannot be resolved from the repository: ArtifactResolutionException: Unable to locate site descriptor: Could not transfer artifact org.eclipse.scout:maven_rt_plugin_config-master:xml:site_en:2.0.7 from/to AAA.libs.release (<REDACTED>): Access denied to: <REDACTED>/org/eclipse/scout/maven_rt_plugin_config-master/2.0.7/maven_rt_plugin_config-master-2.0.7-site_en.xml , ReasonPhrase:Forbidden.
2016-08-18 16:06:45.598 [ERROR] org.eclipse.scout:maven_rt_plugin_config-master:xml:2.0.7
2016-08-18 16:06:45.598 [ERROR] 
2016-08-18 16:06:45.598 [ERROR] from the specified remote repositories:
2016-08-18 16:06:45.598 [ERROR] AAA.libs.release (<REDACTED>, releases=true, snapshots=false),
2016-08-18 16:06:45.599 [ERROR] AAA.libs.snapshots (<REDACTED>, releases=false, snapshots=true),
2016-08-18 16:06:45.599 [ERROR] eclipse.release (https://repo.eclipse.org/content/groups/releases/, releases=true, snapshots=false),
2016-08-18 16:06:45.599 [ERROR] eclipse.snapshot (https://repo.eclipse.org/content/groups/snapshots/, releases=true, snapshots=true),
2016-08-18 16:06:45.599 [ERROR] remote-repos (<REDACTED>, releases=true, snapshots=false)

As you can see, it tries to download the maven_rt_plugin_config-master-2.0.7-site_en.xml, which in fact does not exist. There however does exist such an xml without the _en suffix...

I have specified no locales as far as I can see and there seem to be no changes in the parent project related to site or javadoc generation.

Why does Maven not fall back to the default locale?

Patrick
  • 4,720
  • 4
  • 41
  • 71

4 Answers4

4

A workaround that causes the site plugin to skip looking for the missing file is to create your own site.xml site descriptor with the combine.self attribute set to override:

<project name="Your-Service" combine.self="override">
    ...
</project>

This file should live at src/site/site.xml

Mark
  • 4,970
  • 5
  • 42
  • 66
3

In case this may be help to others trying to figure out why maven is searching for a site.xml or site_en.xml from a parent project and failing when the desire was just to use default settings:

Encountered a similar problem when using SpringBoot. mvn clean site failed trying to transfer spring-boot-starter-parent:xml:site_en:1.4.0.RELEASE from central (https://repo.maven.apache.org/maven2) with:

repo.maven.apache.org:443 repo.maven.apache.org/x.x.x.x failed: Connection timed out: connect

This occurred when the project was configured to use corporate repositories, but did not occur when using maven central direct. Itseems that with the corporate repository in place, the request was being proxied as a secured request. The secured request to central failed with a "time out", failing the build. If the request was not secured, a "not found" would have been returned from central and maven would have continued using default settings. So in this case, a 404 would be good (continue with defaults as desired) other error codes not good (fail the build).

There are a couple of ways around this:

  • install a file into your local repository (hack)
  • configuration change on corporate repo server (probably the real fix, same as described in the accepted answer)
  • configure the proxy setting in the maven settings.xml file

Here is an example of the settings.xml proxy config:

<proxy>
    <active>true</active>
    <protocol>http</protocol>
    <host>my.corporate.proxy</host>
    <port>myPort</port>
    <nonProxyHosts>*.my.corporate.domain|*.my.subsidiary.domain</nonProxyHosts>
</proxy>
Glenn
  • 8,932
  • 2
  • 41
  • 54
2

The reason for this issue was the behaviour of our repository (JFrog Artifactory): The requested repository is a virtual repository, that aggregates several physical repositories.

It replies with a 403 (Forbidden) if the requested artifact cannot be found in the repositories the user has access to - and there exist others that the user does not have access to. Maven then seems to stop looking for an alternative file in the same repository.

There exists a feature request for the JFrog Artifactory to change the behaviour, but (at the time of writing) nobody is working on it.

Our solution was to change the settings.xml to point directly to the repository. Then, Maven will receive a 404 (Not Found) for the English locale version (site_en.xml), and correctly fall back to the default site.xml. Several other Maven plugins also exhibit this issue when presented with a 403.

Patrick
  • 4,720
  • 4
  • 41
  • 71
1

As discussed in other answers, this seems to occur when there are network issues trying to find the files site_en.xml and site.xml associated with the parent in the remote repository. It appears that if the server returns 404 (not found) then all is well, but if the HTTP request returns something else, then the child build aborts. This can be a particular problem if you have multiple remote repositories, as it only needs one to fail for the child build to fail.

A workaround is possible if you have control over the parent project - you can release dummy files alongside the parent pom so the client build no longer relies on getting 404. But you need release both files that the child build is looking for, not just one.

Releasing one file is easy, but releasing both is a bit of a hack. To release both files, use site:attach-descriptor in the parent pom.xml with the following config:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-site-plugin</artifactId>
  <executions>
    <execution>
      <id>attach-descriptor</id>
      <goals>
        <goal>attach-descriptor</goal>
      </goals>
      <configuration>
        <locales>en,de</locales>
      </configuration>
    </execution>
  </executions>
</plugin>

The hack is the locales config. The en causes the site_en.xml file to be attached to the build and pubilshed. The de tries to look for site_de.xml, which does not exist, so instead the code falls back to site.xml instead. Note that de is a randomly chosen locale, but one that actually exists, ie. xx doesn't work.

The actual files should be added alongside the parent pom.xml. The structure of the parent project should be:

- pom.xml
- src
  - site
    - site.xml
    - site_en.xml

This is a suitable dummy file for both src/site/site_en.xml and src/site/site.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Parent-Site">
</project>

PS. the attach-descriptor goal is not inherited, so this config won't affect child builds.

JodaStephen
  • 60,927
  • 15
  • 95
  • 117