github / maven-plugins

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

Method not allowed (405) in version 0.9 #54

Open yegor256 opened 10 years ago

yegor256 commented 10 years ago

Version 0.8 works fine, but version 0.9 on the same pom.xml gives this:

[ERROR] Failed to execute goal com.github.github:site-maven-plugin:0.9:site (default) on project jcabi-aspects: Error creating blob: Not Allowed (405) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.github:site-maven-plugin:0.9:site (default) on project jcabi-aspects: Error creating blob: Not Allowed (405)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating blob: Not Allowed (405)
    at com.github.maven.plugins.site.SiteMojo.createBlob(SiteMojo.java:289)
    at com.github.maven.plugins.site.SiteMojo.execute(SiteMojo.java:352)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: java.io.IOException: Not Allowed (405)
    at org.eclipse.egit.github.core.client.GitHubClient.createException(GitHubClient.java:564)
    at org.eclipse.egit.github.core.client.GitHubClient.sendJson(GitHubClient.java:643)
    at org.eclipse.egit.github.core.client.GitHubClient.post(GitHubClient.java:757)
    at org.eclipse.egit.github.core.service.DataService.createBlob(DataService.java:115)
    at com.github.maven.plugins.site.SiteMojo.createBlob(SiteMojo.java:285)
    ... 22 more
cescoffier commented 10 years ago

How are you configuring the authentication ?

yegor256 commented 10 years ago

This is how: https://github.com/jcabi/parent/blob/parent-0.12/pom.xml#L697-L752

cescoffier commented 10 years ago

using oauth or credential ?

yegor256 commented 10 years ago

And in settings.xml:

<server>
  <id>github</id>
  <username>yegor256</username>
  <password>...</password>
</server>
cescoffier commented 10 years ago

so credentials. Just be be sure, you have checked the credentials ? (in a browser as incognito)

yegor256 commented 10 years ago

Sure, everything works fine with version 0.8, but fails with 0.9. I change nothing except the plugin version number

cescoffier commented 10 years ago

Actually, in 0.9 there is one authentication case which is no more supported:

https://github.com/github/maven-plugins/commit/ec57932ade499f8b28b8e864129515adb9cc6762#diff-cd7f60e4baee0a30ab44fcfcf8f97430

However it doesn't look like you are in this case.

yegor256 commented 10 years ago

Yeah, I use credentials only

cescoffier commented 10 years ago

Can you try to remove the gihub.global.server from your pom file and just use in your settings.xml (should not change)

<server>
    <id>github</id>
    <username>YOUR_GITHUB_USERNAME</username>
    <password>YOUR_PASSWORD</password>
</server>

In addition, configure the <url> from your project to <url>https://github.com/OWNER/PROJECT_NAME</url> (replace OWNER and PROJECT_NAME)

cescoffier commented 10 years ago

Another test, if it's not successful:

In the plugin configuration set:

<repositoryName>PROJECT_NAME<repositoryName>
<repositoryOwner>OWNER</repositoryOwner>
<server>github</server>
yegor256 commented 10 years ago

<url> change didn't help

yegor256 commented 10 years ago

This configuration works:

<plugin>
    <groupId>com.github.github</groupId>
    <artifactId>site-maven-plugin</artifactId>
    <version>0.9</version>
    <configuration>
        <repositoryName>jcabi-aspects</repositoryName>
        <repositoryOwner>jcabi</repositoryOwner>
        <server>github</server>
    </configuration>
</plugin>

Would be nice to see it working without this extra config though...

cescoffier commented 10 years ago

This process just required to spot the issue. The plugin is not able to extract the repository name and owner name from data contained in the pom file.

It looks like the plugin is extracting the information from the SCM metadata. Could you check how they are written in comparison to: http://github.github.com/maven-plugins/site-plugin/project.html

yegor256 commented 10 years ago

This is what I have:

    <scm>
        <connection>scm:git:github.com:jcabi/jcabi-aspects.git</connection>
        <developerConnection>scm:git:github.com:jcabi/jcabi-aspects.git</developerConnection>
        <url>https://github.com/jcabi/jcabi-aspects</url>
    </scm>
yegor256 commented 10 years ago

BTW, 0.8 extracts this information without problems

poblish commented 10 years ago

I'm getting this too:

<plugin>
    <groupId>com.github.github</groupId>
    <artifactId>site-maven-plugin</artifactId>
    <version>0.9</version>
    <configuration>
        <message>Maven artifacts for ${project.version}</message>
        <noJekyll>true</noJekyll>
        <outputDirectory>${project.build.directory}/mvn-repo</outputDirectory>
        <branch>refs/heads/mvn-repo</branch> 
        <includes>
            <include>**/*</include>
        </includes>
        <repositoryName>kodomondo</repositoryName>
        <repositoryOwner>poblish</repositoryOwner> 
    </configuration>
    <executions>
        [...]
    </executions>
</plugin>

This configuration works on other Github projects of mine, the only difference seeming to be the size of the artifact to be uploaded, so I don't think the fact that I lack an <scm> element is relevant. 27 MB is the size of the JAR that is failing for me with the "java.io.IOException: Not Allowed (405)"

ganeshs commented 10 years ago

I too have a similar issue. I get 405 method not allowed when I try to upload files of size over 30MB. It works fine otherwise.

Is there any workaround that we can adopt in the interim?

danieljue commented 10 years ago

I'm also getting this problem--we have a large war overlay file we're trying to put in github as a maven repo.

0471hhw commented 8 years ago

look your config