2x import


(tloonie) #1

Hello,

I have a problem importing two packages, for example: import org.tmatesoft.svn.core.wc* import org.tmatesoft.svn.core.*

What I want to do id create a tag (svnkit doCopy) but I need SVNURL from org.tmatesoft.svn.core.SVNURL and SVNCopyClient in org.tmatesoft.svn.core.wc.SVNCopyClient.

I have similar problem when I want to use / apply two of my own modules, how do I do apply from: ‘myLib1.gradle’ and myLib2.gradle so methods from both are available?

Best regards, Ziga


(René Groeschke) #2

What error messages do you get? Have you declared the buildscript dependency to svnkit in your build file?


(tloonie) #3

Hello Rene, thank you for looking into this. I will try to provide “just enough” info:

If I do this:

file is named: myLib.gradle (should it be .groovy?)

import org.tmatesoft.svn.core.wc*
  buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath group: 'org.tmatesoft.svnkit', name: 'svnkit', version: '1.8.3-1'
    }
}
  def getSvnUrl(String filePath){
    def myFile = file(filePath);
                if (myFile.exists()) {
            ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
        SVNClientManager clientManager = SVNClientManager.newInstance(options);
        SVNStatusClient statusClient = clientManager.getStatusClient();
        SVNStatus status = statusClient.doStatus(myFile, false);
                println "WC:\n" + myFile;
        println "Copy from url:\n" + status.getURL();
            } else {
        print "EXCEPTION, file:" + filePath + " not found!";
        return -1;
    }
}

It works.

Accorging to docs at http://svnkit.com/javadoc/org/tmatesoft/svn/core/wc/SVNStatus.html

the function status.getURL() returns SVNURL so I add this:

SVNURL mySVNURL = status.getURL();

and now I get an error::

Could not compile script ‘C:\work\myLib.gradle’. > startup failed:

script ‘C:\work\SS_PROCREDIT_4_0\myLib.gradle’: 142: unable to resolve class

SVNURL

@ line 142, column 16.

SVNURL mySVNURL = status.getURL();

Now as far as I can tell this would work if I changed the import from

import org.tmatesoft.svn.core.wc*

to

import org.tmatesoft.svn.core.*

but if I do this the initial function will no longer work (and I already have a method to update the working copy that works as well and depends on wc.* import).

I hope the questions is clear now - I want to know how to import both

org.tmatesoft.svn.core.wc* and org.tmatesoft.svn.core.* (or some other).

Thank you in advance!


(tloonie) #4

So it seems that a workaroundfor this is to use full path, for this situation that would be:

org.tmatesoft.svn.core.SVNURL mySVNURL = status.getURL();

I would still like to know how to use multiple imports and multiple “apply from” (or some other way to use multiple modules).

I forgot to mention in initial post - I am using gradle v1.12.