2005-11-04

Last edit

Changed: 37c37,45

< Hmmm, in another project this said 'scp' instead of 'sftp'. And beware, all was good again!

to

> Hmmm, in another project this said 'scp' instead of 'sftp'. So I reset it to scp... And beware, all was good again!
> To reproduce:
> # Install J2SDK 1.4.2 build 03
> # Install Maven 1.0.2
> # Set JAVA_HOME to that directory
> # Update PATH variable to point to $JAVA_HOME/bin
> # Create Maven project and use sftp in project.properties
> # Type ''maven jar:deploy''
> I haven't tested whether it's important, but this is with OpenSSH_3.8.1p1.


Maven, oh, Maven. Funny how much bugs this package brings up. And I don't mean its own bugs!

In the previous post, I discussed "deploying", which is Maven speak for building a jar/war/ear of your project and then copy it to a server where other dependant projects can get it.

This works. However, I documented this procedure using scp. Today I had to configure a project which used the exact same properties, but uses sftp. Of course, Maven flunks out with a NullPointerException (wouldn't you?).

  java.security.NoSuchAlgorithmException: DH KeyPairGenerator not available
  java.lang.NullPointerException
        at com.jcraft.jsch.jce.DH.getE(Unknown Source)
        at com.jcraft.jsch.jce.DHG1.init(Unknown Source)
        at com.jcraft.jsch.Session.receive_kexinit(Unknown Source)
        at com.jcraft.jsch.Session.connect(Unknown Source)

I checked out that same project locally and Maven did work fine here. But not on the shared development box. Difference? Locally, J2SDK 1.4.2 build 08 was installed and on the development box, version 1.4.2 build 03 was installed. There was a difference of a few files and besides font.properties stuff, they were related to security:

  $ diff list_j2sdk142_03 list_j2sdk142_08
  < ./jre/lib/old_security
  < ./jre/lib/old_security/cacerts
  < ./jre/lib/old_security/java.policy
  < ./jre/lib/old_security/java.security
  < ./jre/lib/old_security/local_policy.jar
  < ./jre/lib/old_security/US_export_policy.jar
  < ./jre/lib/security/jce1_2_2.jar
  < ./jre/lib/security/sunjce_provider.jar
  > ./jre/lib/security/cacerts
  > ./jre/lib/security/java.policy
  > ./jre/lib/security/java.security

Hmm.. Weird. After installing the new J2SDK build on the development box, the stacktrace didn't appear, but Maven quitted with an error nevertheless:

  Will deploy to 1 repository(ies): R1
  Deploying to repository: R1
  Using private key: /home/the_user/.ssh/id_rsa
  Deploying:
  /home/the_user/tmp/OUR_PROJECT/OUR_SUBPROJECT/project.xml-->OUR_PROJECT/poms/OUR_SUBPROJECT-0.2.0-build4-SNAPSHOT.pom Failed to deploy to: R1 Reason: Error occured while deploying to remote host:repository.the.company:null
  BUILD FAILED
  File...... /home/the_user/.maven/cache/maven-multiproject-plugin-1.3.1/plugin.jelly
  Element... maven:reactor
  Line...... 217
  Column.... 9
  Unable to obtain goal [multiproject:deploy-callback] -- /home/the_user/.maven/cache/maven-artifact-plugin-1.4.1/plugin.jelly:94:13: <artifact:artifact-deploy> Unable to deploy to any repositories

Then my eye fell on the sftp line in the project.properties:

  maven.repo.R1=sftp://repository.the.company

Hmmm, in another project this said 'scp' instead of 'sftp'. So I reset it to scp... And beware, all was good again!

To reproduce:

  1. Install J2SDK 1.4.2 build 03
  2. Install Maven 1.0.2
  3. Set JAVA_HOME to that directory
  4. Update PATH variable to point to $JAVA_HOME/bin
  5. Create Maven project and use sftp in project.properties
  6. Type maven jar:deploy

I haven't tested whether it's important, but this is with OpenSSH_3.8.1p1.