Partage
  • Partager sur Facebook
  • Partager sur Twitter

[SVNKit] Problème avec le checkout

    29 octobre 2014 à 11:48:21

    Bonjour,

    Je suis bloqué. J'essaie de faire un checkout en suivant cette méthode :

    SVNRepository repository = null;
    				
    try{
    //initiate the reporitory from the url
    SVNURL url = SVNURL.parseURIEncoded(addrRepo);
    					
    repository = SVNRepositoryFactory.create(url);
    					
    //create authentication data
    ISVNAuthenticationManager authManager = 
    			SVNWCUtil.createDefaultAuthenticationManager(username, passwd);
    repository.setAuthenticationManager(authManager);
    //output some data to verify connection
    	
    //need to identify latest revision
    long latestRevision = repository.getLatestRevision();
    					
    //create client manager and set authentication
    SVNClientManager ourClientManager = SVNClientManager.newInstance();
    ourClientManager.setAuthenticationManager(authManager);
    //use SVNUpdateClient to do the export
    SVNUpdateClient updateClient = ourClientManager.getUpdateClient( );
    updateClient.setIgnoreExternals( false );
    					
    File file = new File(destPath);
    System.out.println("--"+repository.getRepositoryRoot(true));
    System.out.println("--"+file.getAbsolutePath());
    System.out.println("--"+latestRevision);
    System.out.println("--"+SVNDepth.INFINITY);
    updateClient.doCheckout(repository.getRepositoryRoot(true), 
    	file, 
    	SVNRevision.create(latestRevision), 
    	SVNRevision.create(latestRevision), 
    	SVNDepth.INFINITY, 
    	false);
    					
    } catch (SVNException e1) {
    	e1.printStackTrace();
    }


    Où évidement, addrRepo est l'adresse URL de mon dépôt SVN, username et passwd  sont respectivement mon identifiant et mon mot de passe.

    Quand j'exécute ce code dans un main, j'ai une erreur :

    Exception in thread "ConnexionToServer" java.lang.NoClassDefFoundError: org/antlr/runtime/RecognitionException
    	at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine$2.runSynchronized(SqlJetEngine.java:282)
    	at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.runSynchronized(SqlJetEngine.java:217)
    	at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.readSchema(SqlJetEngine.java:276)
    ...

    J'ai essayé de débugger, et j'ai une erreur, semblerait-il, lors de l'appel de la fonction org.tmatesoft.svn.core.wc2.SvnOperationFactory.isVersionnedDirectory(File, boolean). Mais je n'ai pas d'autres informations, je galère depuis plusieurs jours.

    Je sèche! 

    Quelqu'un saurait-il me dépanner ?

    Merci d'avance

    • Partager sur Facebook
    • Partager sur Twitter
      30 octobre 2014 à 22:24:00

      Bonsoir,

      Merci, ce code a très bien fonctionné chez moi :lol:. Je venais juste de voir la bibliothèque SVNKit, il y a 5 minutes :lol: (pas vraiment eu le temps de l'étudier en profondeur :lol:). L'erreur ne viens pas ce bout de code, de plus vous n'avez pas tout mis du message d'erreur. Le mieux serait de mettre tous ce qui est mis.

      C'est au moment de l'exécution du code ?

      PS : Vous pouvez essayer ceci, pour voir : (n'oubliez pas de créer un dossier "test" à la racine du projet).

      public static void main ( String [] sArgs ) throws SVNException {
              SVNRepository repository = null;
      
              try{
              //initiate the reporitory from the url
              SVNURL url = SVNURL.parseURIEncoded("svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK/");
      
              repository = SVNRepositoryFactory.create(url);
      
              //create authentication data
              ISVNAuthenticationManager authManager =
                          SVNWCUtil.createDefaultAuthenticationManager("", "");
              repository.setAuthenticationManager(authManager);
              //output some data to verify connection
      
              //need to identify latest revision
              long latestRevision = repository.getLatestRevision();
      
              //create client manager and set authentication
              SVNClientManager ourClientManager = SVNClientManager.newInstance();
              ourClientManager.setAuthenticationManager(authManager);
              //use SVNUpdateClient to do the export
              SVNUpdateClient updateClient = ourClientManager.getUpdateClient( );
              updateClient.setIgnoreExternals( false );
      
              File file = new File("test");
              System.out.println("--"+repository.getRepositoryRoot(true));
              System.out.println("--"+file.getAbsolutePath());
              System.out.println("--"+latestRevision);
              System.out.println("--"+SVNDepth.INFINITY);
              updateClient.doCheckout(repository.getRepositoryRoot(true),
                  file,
                  SVNRevision.create(latestRevision),
                  SVNRevision.create(latestRevision),
                  SVNDepth.INFINITY,
                  false);
      
              } catch (SVNException e1) {
                  e1.printStackTrace();
              }
          }

      Bonne continuation.

      -
      Edité par pctronique 30 octobre 2014 à 22:33:13

      • Partager sur Facebook
      • Partager sur Twitter

      [SVNKit] Problème avec le checkout

      × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
      × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
      • Editeur
      • Markdown