mschonaker / wagon-git

Git Wagon for Apache Maven
http://synergian.github.io/wagon-git/
83 stars 31 forks source link

Deploying 3rd party jars #29

Closed ymmijgno closed 9 years ago

ymmijgno commented 9 years ago

Hi,

I followed the guide here: http://synergian.github.io/wagon-git/installation.html to deploy a 3rd party jar but received the following exception:

Exception in thread "main" java.lang.NoSuchMethodError: org.codehaus.plexus.util.xml.pull.MXParser.<init>(Lorg/codehaus/plexus/util/xml/pull/EntityReplacementMap;)V
    at org.apache.maven.settings.io.xpp3.SettingsXpp3Reader.read(SettingsXpp3Reader.java:523)
    at org.apache.maven.settings.io.xpp3.SettingsXpp3Reader.read(SettingsXpp3Reader.java:557)
    at org.apache.maven.settings.io.DefaultSettingsReader.read(DefaultSettingsReader.java:92)
    at org.apache.maven.settings.building.DefaultSettingsBuilder.readSettings(DefaultSettingsBuilder.java:169)
    at org.apache.maven.settings.building.DefaultSettingsBuilder.build(DefaultSettingsBuilder.java:91)
    at org.apache.maven.cli.MavenCli.settings(MavenCli.java:766)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:209)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    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:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
mvn_deploy.sh: line 7: -Durl=git:releases://git@bitbucket.org:my-repo-url.git: No such file or directory

I have included the 0.2.3 shaded jar in $M2_HOME/lib. Any ideas?

mschonaker commented 9 years ago

Hi,

may I see your settings.xml, your pom.xml and the code of the script?

ymmijgno commented 9 years ago

Its a third party jar, so no pom.xml.

Here's the script to deploy:

mvn deploy:deploy-file \
    -DgroupId=net.sf.minuteproject \
    -DartifactId=mp-bsla \
    -Dversion=0.8.3 \
    -Dfile=mp-bsla-0.8.3.jar \
    -DgeneratePom=true \
    -DrepositoryId=my-maven-repo \
    -Durl=git:releases://git@github.org:myusername/my-maven-repo.git

Here's the partial settings.xml:

<servers>
    ...
    <server>
        <id>my-maven-repo</id>
        <username>myusername</username>
        <configuration>
            <httpHeaders>
                <property>
                    <name>Authorization</name>
                    <value>Basic somevalues</value>
                </property>
            </httpHeaders>
        </configuration>
    </server>
</servers>
mschonaker commented 9 years ago

I see two error reports in that message.

The first part looks like maven can't parse some part of your settings file. You should refer to the settings.xml reference of the maven version you're using. The httpHeaders part is a workaround for 2.0.9. Maybe they've changed it.

HOWEVER, that configuration is for consuming artifacts through HTTP, once artifacts have been deployed. That's unrelated to wagon-git code, it's regular HTTP access to repositories that we've added in the configuration so people can configure a Github repository.

You could remove that part of the settings.xml to deploy a file.

wagon-git uses gitexe. Which means that it invokes git with a command line. Authentication is on behalf of git. git is agnostic of Maven, and thus, agnostic of your settings.xml. git will ask you for ssh credentials as it regularly does, or will use .netrc credentials (depending on the URL).

As per the second error: mvn_deploy.sh: "line 7: -Durl=git:releases://git@bitbucket.org:my-repo-url.git: No such file or directory" this looks like your shell is not interpreting the script as you want. Just like if the line 7 was separated of the other lines.

ymmijgno commented 9 years ago

OK, I fixed the the deploy script. So that's my bad. Now things work but only for 0.2.0 to 0.2.2. 0.2.3 and 0.2.4 resulted in the following error:

Exception in thread "main" java.lang.NoSuchMethodError: org.codehaus.plexus.util.xml.pull.MXParser.<init>(Lorg/codehaus/plexus/util/xml/pull/EntityReplacementMap;)V
    at org.apache.maven.settings.io.xpp3.SettingsXpp3Reader.read(SettingsXpp3Reader.java:523)
    at org.apache.maven.settings.io.xpp3.SettingsXpp3Reader.read(SettingsXpp3Reader.java:557)
    at org.apache.maven.settings.io.DefaultSettingsReader.read(DefaultSettingsReader.java:92)
    at org.apache.maven.settings.building.DefaultSettingsBuilder.readSettings(DefaultSettingsBuilder.java:169)
    at org.apache.maven.settings.building.DefaultSettingsBuilder.build(DefaultSettingsBuilder.java:91)
    at org.apache.maven.cli.MavenCli.settings(MavenCli.java:766)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:209)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    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:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

The settings.xml file does not seem to be the cause of the error.

mschonaker commented 9 years ago

Thanks for the report. I'll review the changes.

May I know the version of Maven you're using?

Does this help? http://stackoverflow.com/a/24220671/368544

Regards.

ymmijgno commented 9 years ago

I've tried on 3.1.1 and 3.2.2. No difference between the versions. No, the suggestions in the stackoverflow are not helpful. Renaming/removing the .m2 repository do not trigger any artifacts downloads as the exception will be thrown before that.

And here's my PATH for your reference:

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
export M2_HOME=~/Programs/apache-maven-3.2.2
export PATH=$PATH:$M2_HOME/bin
mschonaker commented 9 years ago

For the record. I had this problem when added wagon-git jar among the Maven libs.

mschonaker commented 9 years ago

Got it working for Maven 3.2.2 by updating some dependencies. Try with version 0.2.5.