github / maven-plugins

Official GitHub Maven Plugins
MIT License
584 stars 198 forks source link

Blob 404 Error #13

Closed GLitchfield closed 12 years ago

GLitchfield commented 12 years ago

Kevin, I am having the same issue Guillaume was in issue #10. Unfortunately I have been unsuccessful in turning the dialog into a working solution. I have only been using GitHub for a few weeks now, so I believe that some amount of common knowledge is being assumed that I am lacking. Guillaume said he has success setting the repositoryName and repositoryOwner in the configuration, but didn't leave any examples, so I have spent a lot of time making best guesses.

What is happening: I run the plugin, and after it builds the maven sites, it attempts to upload them to my gh-pages branch of my project.

The main project uploads successfully, but fails when it attempts to upload the first module. I am able to go to my gh-pages and see the maven site for the top level project, but obviously the links to the module all return 404 errors.

It seems as though the plug-in should be creating these folders in the project before it attempts to upload the modules. I have tried a number of different permutations of setting the repositoryName and owner of the modules, but maybe an example would clarify what is expected here. I have also tried setting path and includes, but I'm not really clear on what these are expecting. Ignorance is not bliss ;)

You asked Guillaume if he wanted all the site's generated modules to be in the same repository's gh-pages under different paths or in separate repos. I believe I'd like them to be in the main project's directory. Eg:

FruitStand-Project Main project site FruitStand-Project-Bananas Module FruitStand-Project-Kiwis Module

So what I would expect is that in my github project, aka

https://github.com/FruitStand/FruitStand-Project/tree/gh-pages

There would be the index.html file for the main maven page, as well as other resources. It would also have folders named

FruitStand-Project-Bananas FruitStand-Project-Kiwis

Which would have my actual main maven site at:

http://FruitStand.github.com/FruitStand-Project/

and its modules at

http://FruitStand.github.com/FruitStand-Project/FruitStand-Project-Bananas http://FruitStand.github.com/FruitStand-Project/FruitStand-Project-Kiwis

In this example, how should the pom.xml be configured for the main FruitStand-Project and FruitStand-Project-Kiwis?

Your help is greatly appreciated. Gavin

kevinsawicki commented 12 years ago

Can you provide the section of your POM files that configure the GitHub site plugin?

Thanks

kevinsawicki commented 12 years ago

Also, can you please also confirm what version of the GitHub site plugin you are using?

GLitchfield commented 12 years ago

The pom of the top level project:

<scm>
    <url>https://github.com/barchart/barchart-feed-ddf</url>
    <connection>scm:git:git://github.com/barchart/barchart-feed-ddf.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/barchart/barchart-feed-ddf.git</developerConnection>
</scm>
<modules>
    <module>barchart-feed-ddf-util</module>
<modules>
<pluginRepositories>
    <pluginRepository>
        <id>oss-sonatype-snapshots</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </pluginRepository>
</pluginRepositories>
<plugin>
    <groupId>com.github.github</groupId>
    <artifactId>site-maven-plugin</artifactId>
        <version>0.5</version>
        <configuration>
        <message>Creating site for ${project.version}</message>
        <includes>${barchart-feed-ddf-util}</includes>
        </configuration>
        <executions>
        <execution>
              <goals>
                <goal>site</goal>
              </goals>
              <phase>site</phase>
        </execution>
    </executions>
</plugin>

Each module has pom configuration

<scm>
    <url>https://github.com/barchart/barchart-feed-ddf</url>
    <connection>scm:git:git://github.com/barchart/barchart-feed-ddf.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/barchart/barchart-feed-ddf.git</developerConnection>
</scm>

<plugin>
          <groupId>com.github.github</groupId>
          <artifactId>site-maven-plugin</artifactId>
          <version>0.5</version>
          <configuration>
            <message>Creating site for ${project.version}</message>

            <merge>true</merge>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>site</goal>
              </goals>
              <phase>site</phase>
            </execution>
          </executions>
</plugin>  

As you can see, I'm using v0.5, which I believe is the latest. I have excluded the repositoryName and repositoryOwner from the module's pom, as I am unsure what it should be.

Thanks for your help Gavin

kevinsawicki commented 12 years ago

Can you try upgrading to 0.6 which is the latest?

Also, if you leave the site plugin configuration out from the module and just have it in the parent POM, does the modules site still get generated when running mvn site from the top level?

GLitchfield commented 12 years ago

I got the same result when I switched to 0.6, however after I removed the plugin config from the module everything ran successfully, much to my delight.

However, after giving the site about 20 minutes to update, the module links from the parent project still return 404. Is it possible the plug-in is putting them somewhere besides ...barchart-feed-ddf/barchart-feed-ddf-module?

Thanks agavin

kevinsawicki commented 12 years ago

Do you see a commit to the gh-pages branch in the parent project's repository?

Does the latest commit there (after you last ran mvn site) show the layout of the site you expect?

If not, what is missing?

GLitchfield commented 12 years ago

In my gh-pages repository, my expectation would be to see folders corresponding to each module inside the parent project, because that's where the module links in the maven site take you. However, they were not created when I ran the plug-in.

kevinsawicki commented 12 years ago

So here are the steps I performed locally to generate a site from the project root for a project with multiple modules.

  1. Configure the GitHub site plugin in the parent's pom.xml file with the following configuration elements:
<merge>false</merge>
<message>Building site for ${project.artifactId} ${project.version}</message>
  1. Configure the GitHub site plugin in each module's pom.xml file with the following configuration elements:
<merge>true</merge>
<path><!-- Put name of module here such as barchart-feed-ddf-assembly --></path>
<message>Building site for ${project.artifactId} ${project.version}</message>
  1. Run mvn site from the parent directory

You need to tell each module's site plugin configuration the path you want to use in the gh-pages branch which should be the name of the module in the parent pom.xml file modules element.

Please let me know if you have any questions about the instructions. I know this doesn't seem ideal and I will work on improving support for multi-module site.

GLitchfield commented 12 years ago

I made the changes you suggested and I now see the module folders in my gh-pages repository. I still am not seeing the resource in the actual site however, i.e. 404 error on the module link. I'm going to investigate a bit further and report back tomorrow. Let me know if you think of anything.

Thanks again for the help. This is a great plug-in, I'm sure I'm close to victory.

kevinsawicki commented 12 years ago

I'm going to fork that repository, make the changes and just submit a pull request with the POM changes.

kevinsawicki commented 12 years ago

I have opened this pull request with some minor changes that hopefully generates the site layout you are looking for.

GLitchfield commented 12 years ago

This is all working now, many thanks. I am unsure what the difference is between your changes and my last attempt which was not committed. I know I had the paths set as you have them. It may have had something to do with the corrupted head problem we were experiencing.

In any case, this is a great plug-in, I'm happy to understand the setup now for a project with modules.

Thanks Gavin

kevinsawicki commented 12 years ago

Glad to hear things are working now!