github / maven-plugins

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

site plugin does not support multi-module site deployment #22

Open jdillon opened 12 years ago

jdillon commented 12 years ago

When running the github site plugin on a mutli-module build (such as https://github.com/sonatype/install4j-support) each module's site will be deployed into the top-level directory, clobbering the previous module and generally making an unusable site.

kevinsawicki commented 12 years ago

You can place in them different sub-directories by specifying a path element in each module's site plugin configuration.

jdillon commented 11 years ago

Any reason its not using the standard mechanism to handle this similar to:

https://github.com/stephenc/wagon-gitsite

site-deploy should handle this automatically and configure the locations appropriately.

mmichaelis commented 11 years ago

+1 - its much boilerplate code in order to ensure that every module gets deployed to the correct folder. This is especially annoying as providing multi-module-sites is already not a piece of cake.

mmichaelis commented 11 years ago

Eventually I have found a workaround reading and understanding Maven > Guide to creating a site:

If subprojects inherit the site URL from a parent POM, they will automatically append their <artifactId> to form their effective deployment location.

Having this and trying to deploy to a GH-pages subdirectory site/<version> you need to do these steps in your root POM (and without the need to do additional configuration in the sub-POMs):

  1. Configure <distributionManagement> as dummy to get the URL from:

    <distributionManagement>
     <site>
       <id>github-pages-site</id>
       <name>Deployment through GitHub's site deployment plugin</name>
       <url>site/${project.version}</url>
     </site>
    </distributionManagement>
    
  2. Disable deployment for the maven-site-plugin (in this example you also see how to add markdown to your site):

    <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-site-plugin</artifactId>
     <version>3.1</version>
     <dependencies>
       <dependency>
         <!--
         | allows markdown syntax for site generation. To use it place files below
         | src/site/markdown/[filename].md
         -->
         <groupId>org.apache.maven.doxia</groupId>
         <artifactId>doxia-module-markdown</artifactId>
         <version>1.3</version>
       </dependency>
     </dependencies>
     <configuration>
       <skipDeploy>true</skipDeploy>
     </configuration>
    </plugin>
    
  3. Configure the site-maven-plugin as follows:

    
    <plugin>
     <groupId>com.github.github</groupId>
     <artifactId>site-maven-plugin</artifactId>
     <version>0.7</version>
     <configuration>
       <message>Creating site for ${project.artifactId}, ${project.version}</message>
       <!-- this does the trick to place every module in the correct subfolder -->
       <path>${project.distributionManagement.site.url}</path>
       <merge>true</merge>
     </configuration>
     <executions>
       <execution>
         <id>github-site</id>
         <goals>
           <goal>site</goal>
         </goals>
         <phase>site-deploy</phase>
       </execution>
     </executions>
    </plugin>
    
sebastiangraf commented 11 years ago

Would be great to support the deploy-site workflow out of the box. A few months ago, I just combined it with a few lines of inlay-ant (described over http://goo.gl/2xE7C), but I think, Mark's solution is much more elegant.

rafael-alcantara commented 11 years ago

I vote for this issue, as I would expect it to behave just as maven-site-plugin does, deploying child modules under the parent directory, without the need of extra configuration in the pom files. Thanks for this plugin :)

stephanenicolas commented 11 years ago

Same for me. It's really hard to get things working, even @mmichaelis's solution doesn't seem to work, or hardly, for our projects. I believe this site plugin is the best way to make people re-adopt the site phase in maven and GH's plugin is really worth solving this problem.

branflake2267 commented 11 years ago

I think it would be handy to have <skip>true</skip> available for the plugin so that it would ignore the plugin it if set to true.

bdemers commented 11 years ago

I was able to get a multi-module build to work with @mmichaelis comments, the problem is the site cannot be deployed to the root of the gh-pages branch. So I had to create a initial index.html to point to /site

I really like the idea of this plugin, but I second the comments above that this should be implemented in a wagon (using GitHubClient seems super slow as well)

I gave https://github.com/stephenc/wagon-gitsite a shot but it did not work with an enterprise instance. It looks like it would be trivial to patch it, but the project looks dead (anyone have any thoughts on this?).

yegor256 commented 11 years ago

+1 waiting for a fix

anjackson commented 10 years ago

+1

@bdemers You can remove the /site prefix by taking it out of the configuration:

<distributionManagement>
  <site>
    <id>github-pages-site</id>
    <name>Deployment through GitHub's site deployment plugin</name>
    <url>${project.version}</url>
  </site>
</distributionManagement>
trajano commented 10 years ago

Is there a sample project on github that demonstrates the multimodule functionality?

docwhat commented 10 years ago

:+1: And include documentation!

trajano commented 10 years ago

I created my own wagon implementation to handle github pages https://github.com/trajano/wagon-git and works with multi-module and inherited site projects.

mbellomo commented 10 years ago

+1 for a fix

barmintor commented 9 years ago

+1

ekohlwey commented 9 years ago

@jdillon @bdemers (and for other's FYI) I also had difficulty using @stephenc's wagon plugin, but I did get @trajano's wagon to work after a little fiddling with the ssh. The (presently undocumented) trick for me was to add a server in ~/.m2/settings.xml. This wagon is nice because it doesn't require a prefix or anything and the site looks "normal" in all regards.

I would imagine it can work with any git repository using the git:ssh type connection. https://github.com/trajano/wagon-git

Notes from my POM:

Set up distribution management in the normal maven way:

<distributionManagement>
    <site>
      <id>github-project-site</id>
      <name>Deployment through GitHub's site deployment plugin</name>
      <url>git:ssh://git@github.com/ekohlwey/myproject.git?gh-pages#</url>
    </site>
</distributionManagement>

Set up the git site plugin in the normal maven way

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-site-plugin</artifactId>
    <version>3.4</version>
    <dependencies>
      <dependency>
        <groupId>org.apache.maven.doxia</groupId>
        <artifactId>doxia-module-markdown</artifactId>
        <version>1.6</version>
      </dependency>
      <dependency>
        <groupId>net.trajano.wagon</groupId>
        <artifactId>wagon-git</artifactId>
        <version>2.0.0</version>
      </dependency>
    </dependencies>
  </plugin>

Add a server in ~/.m2/settings.xml

<server>
    <id>github-project-site</id>
    <username>git</username>
 </server>
ptahchiev commented 9 years ago

+1 for this

trajano commented 9 years ago

The current version 2.0.1 simplifies the work a bit for github specific sites as documented in http://site.trajano.net/wagon-git/

The URL is just in the form:

github:http://trajano.github.io/trajano/

This also works with CNAMEd URIs such as http://site.trajano.net/trajano/ whose https://github.com/trajano/trajano/blob/master/pom.xml#L75 shows the pom.xml being used.

IgorRodchenkov commented 9 years ago

wagon-git (2.0.2) looks promising but always fails for me due to auth. failure (I believe I tried all possible username/password/passphrase/none.. combinations in my settings.xml server; git commands and 'ssh -T git@github.com' works fine.)

[INFO] >>> to github:http://whatever.github.io/proj/./ github:http://whatever.github.io/proj/ - Session: Disconnecting
github:http://whatever.github.io/proj/ - Session: Disconnected ...

trajano commented 9 years ago

@ed the documentation has been updated

On Thu, Mar 26, 2015 at 3:16 PM, Igor Rodchenkov notifications@github.com wrote:

wagon-git (2.0.2) looks promising but always fails for me due to auth. failure (I believe I tried all possible username/password/passphrase/none.. combinations in my settings.xml server; git commands and 'ssh -T git@github.com' works fine.) [INFO] >>> to github:http://whatever.github.io/proj/./ github:http://whatever.github.io/proj/ - Session: Disconnecting
github:http://whatever.github.io/proj/ - Session: Disconnected

...

Reply to this email directly or view it on GitHub: https://github.com/github/maven-plugins/issues/22#issuecomment-86676866

IgorRodchenkov commented 9 years ago

Which documentation? (https://github.com/trajano/wagon-git is still the same as yesterday)

trajano commented 9 years ago

It's been updated a while back. I forgot to note on the ticket. This is in regards to @ed comment.

On Thu, Mar 26, 2015 at 3:44 PM, Igor Rodchenkov notifications@github.com wrote:

Which documentation? (https://github.com/trajano/wagon-git is still the same as yesterday)

Reply to this email directly or view it on GitHub: https://github.com/github/maven-plugins/issues/22#issuecomment-86687794

bbarker commented 9 years ago

I have 10 pom.xml files in a project, and I get exactly 10 commits & pushes when I run mvn site. What is a good way to condense all this into 1 commit and 1 push, or at the very least, multiple commits and 1 push (multiple pushes are bad for heroku)? I tried the wagon plugin but didn't notice any difference (i.e. there were still multiple pushes and the diffs between output docs were essentially identical).

krico commented 9 years ago

:+1:

puce77 commented 9 years ago

Any update on this issue? Or is the recommendation now not to use the plugin but the standard site plugin with wagon-git?

IgorRodchenkov commented 9 years ago

Hi,

Using mostly mmichaelis's and anjackson's comments in this thread, I finally found a configuration that works ok for our project (the site is deployed to the gh-pages branch https://github.com/PathwayCommons/cpath2/tree/gh-pages, and shows up online http://pathwaycommons.github.io/cpath2/6.1.0-SNAPSHOT/)

See in the pom.xml: https://github.com/PathwayCommons/cpath2/blob/master/pom.xml#L385 https://github.com/PathwayCommons/cpath2/blob/master/pom.xml#L855 https://github.com/PathwayCommons/cpath2/blob/master/pom.xml#L996 etc. (but you need to edit the project.distributionmanagement.url if you want to perform site:stage first; see the comments there)

All the best, Igor R.

On Fri, Jun 12, 2015 at 6:07 PM, Florian Brunner notifications@github.com wrote:

Any update on this issue? Or is the recommendation now not to use the plugin but the standard site plugin with wagon-git?

— Reply to this email directly or view it on GitHub https://github.com/github/maven-plugins/issues/22#issuecomment-111630118 .

XsubinX commented 8 years ago

A simple solution is to cleverly use the path and url

<plugin>
    <groupId>com.github.github</groupId>
    <artifactId>site-maven-plugin</artifactId>
    <version>0.12</version>
    <configuration>
        <message>Creating site for ${project.url} version ${project.version}</message>
        <host>${github.host}</host>
        <server>${github.server.id}</server>
        <path>${github.site.path}</path>
        <merge>true</merge>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>site</goal>
            </goals>
            <phase>site</phase>
        </execution>
    </executions>
</plugin>

In parent

<url>https://github.com/XsubinX/multi-module-parent</url>
<properties>
    <github.host>github.com</github.host>
    <github.server.id>github</github.server.id> <!-- id as in your settings.xml-->
    <github.site.path>${project.version}</github.site.path>
</properties>

In child projects

_Do not add url. Let it inherit from parent_

<properties>
    <github.site.path>${project.version}/${project.artifactId}</github.site.path>
</properties>
IgorRodchenkov commented 8 years ago

That's an excellent answer, sounds like what I was long looking for, and I am going to try this a.s.a.p.

Thanks a lot.

On Thu, Jan 21, 2016 at 11:45 AM, Subin Sugunan notifications@github.com wrote:

A simple solution is to cleverly use the path and url

com.github.github site-maven-plugin 0.12 Creating site for ${project.url} version ${project.version} ${github.host} ${github.server.id} ${github.site.path} true site site

In parent

https://github.com/XsubinX/multi-module-parent github.com github ${project.version}

In child projects

Do not add url. Let it inherit from parent

${project.version}/${project.artifactId}

— Reply to this email directly or view it on GitHub https://github.com/github/maven-plugins/issues/22#issuecomment-173630031 .

WolfgangFahl commented 5 years ago

I have done a somewhat detailed analysis and came up with a decent work-around

patpatpat123 commented 3 years ago

Hello everyone,

Now year 2021, 9 years after the issue was opened, would it be possible to have true support for multi-module site deployment for site plugin please?

Many thanks!