dependsOn wants to pull dependency via Ivy

215 views
Skip to first unread message

Michael Sperber

unread,
Apr 18, 2013, 8:49:13 AM4/18/13
to simple-b...@googlegroups.com

I've got problem with a multi-project build where Build.scala looks like
so:

import sbt._
import Keys._

object EQUALSBuild extends Build {
lazy val EQUALS = Project(id = "EQUALS",
base = file(".")) dependsOn EncryptedLogger

lazy val ShutdownDBServer = Project(id = "ShutdownDBServer",
base = file("ShutdownDBServer"))

lazy val PostInstallDBUpdater = Project(id = "PostInstallDBUpdater",
base = file("PostInstallDBUpdater")) dependsOn EncryptedLogger

lazy val EncryptedLogger = Project(id = "EncryptedLogger", base = file("EncryptedLogger"))
}

In build.sbt, I've got this:

scalaVersion in ThisBuild := "2.9.2"

Now, PostInstallDBUpdater builds fine. However, EQUALS gives me this:

[warn] module not found: encryptedlogger#encryptedlogger_2.9.2;0.1-SNAPSHOT
...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: encryptedlogger#encryptedlogger_2.9.2;0.1-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: encryptedlogger#encryptedlogger_2.9.2;0.1-SNAPSHOT: not found

I have no idea why it's trying to manage this dependency through Ivy,
or how to fix the problem. It looks similar to this:

http://comments.gmane.org/gmane.comp.lang.scala.simple-build-tool/3125

But I figured I'd taken care of this with the setting of scalaVersion.

Help would be much appreciated!

--
Regards,
Mike

Robin Green

unread,
Apr 19, 2013, 4:38:24 AM4/19/13
to simple-b...@googlegroups.com, spe...@deinprogramm.de
I had the same problem, and I think you need to publish (or publish-local) each subproject that is depended on by another subproject. And republish it every time you change it.

This would be required in any case if you were to publish any of the dependents.

Michael Sperber

unread,
Apr 19, 2013, 4:46:25 AM4/19/13
to simple-b...@googlegroups.com

Thanks for looking into this!

Robin Green <gre...@gmail.com> writes:

> I had the same problem, and I think you need to publish (or publish-local)
> each subproject that is depended on by another subproject. And republish it
> every time you change it.
>
> This would be required in any case if you were to publish any of the
> dependents.

OK. But I don't want to publish anything. Moreover, why does
compiling PostInstallDBUpdater - which has the exact same dependency -
work?

> On Thursday, 18 April 2013 13:49:13 UTC+1, Michael Sperber wrote:

>> object EQUALSBuild extends Build {
>> lazy val EQUALS = Project(id = "EQUALS",
>> base = file(".")) dependsOn EncryptedLogger
>>
>> lazy val ShutdownDBServer = Project(id = "ShutdownDBServer",
>> base = file("ShutdownDBServer"))
>>
>> lazy val PostInstallDBUpdater = Project(id = "PostInstallDBUpdater",
>> base = file("PostInstallDBUpdater")) dependsOn EncryptedLogger
>>
>> lazy val EncryptedLogger = Project(id = "EncryptedLogger", base =
>> file("EncryptedLogger"))
>> }

--
Regards,
Mike

Josh Suereth

unread,
Apr 20, 2013, 8:36:35 AM4/20/13
to simple-b...@googlegroups.com
Actually, the only reason this would be happening is if you're mucking with the fullResolvers property.   By Default, sbt includes and inter-project resolver that ignores normal Ivy resolution in favor of SBT"s inter-project task dependencies.  It's a mad hack to try to make multi-module project building faster/seamless and not require publishing to local.


Any chance we could see more of your build file?


--
Regards,
Mike

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-t...@googlegroups.com.
To post to this group, send email to simple-b...@googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



Michael Sperber

unread,
Apr 20, 2013, 10:48:28 AM4/20/13
to simple-b...@googlegroups.com

Thanks for looking into this!

Josh Suereth <joshua....@gmail.com> writes:

> Actually, the only reason this would be happening is if you're mucking with
> the fullResolvers property. By Default, sbt includes and inter-project
> resolver that ignores normal Ivy resolution in favor of SBT"s inter-project
> task dependencies. It's a mad hack to try to make multi-module project
> building faster/seamless and not require publishing to local.
>
>
> Any chance we could see more of your build file?

Hah, that must be it!

I've got this:

externalIvySettings() // use ivysettings.xml

... as the Ivy settings are shared with a bunch of Ant scripts. (Don't
ask ...) And ivysettings.xml mainly overrides the resolvers:

<ivysettings>
<caches defaultCacheDir="${basedir}/ivy"/>
<settings defaultResolver="chain"/>
<resolvers>
<chain name="chain">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="Maven Main" m2compatible="true" root="http://repo1.maven.org/maven2/"/>
<ibiblio name="Maven 1" m2compatible="true" root="http://download.java.net/maven/1/"/>
<ibiblio name="SpringSource release" m2compatible="true" root="http://repo.springsource.org/release"/>
<ibiblio name="SpringSource mlestone" m2compatible="true" root="http://repo.springsource.org/milestone"/>
<ibiblio name="Atlassian (HSQL)" m2compatible="true" root="https://repository.atlassian.com/maven2"/>
<ibiblio name="Mayo (JCalendar)" m2compatible="true" root="http://informatics.mayo.edu/maven/content/groups/public"/>
</chain>
</resolvers>
</ivysettings>

Can I somehow restore the inter-project resolver even though
I'm using ivysettings.xml?

Thanks for figuring this out!

--
Regards,
Mike

Mark Harrah

unread,
Apr 22, 2013, 9:50:05 AM4/22/13
to simple-b...@googlegroups.com
Yes, you can add it as a resolver in your chain ("inter-project"). The problem is that other tools that read the ivysettings.xml won't think it is defined. I'm not sure how else to do this, though.

-Mark

> Thanks for figuring this out!
>
> --
> Regards,
> Mike
>

Michael Sperber

unread,
Apr 24, 2013, 3:09:28 AM4/24/13
to simple-b...@googlegroups.com

Mark Harrah <dmha...@gmail.com> writes:

> Yes, you can add it as a resolver in your chain ("inter-project").
> The problem is that other tools that read the ivysettings.xml won't
> think it is defined. I'm not sure how else to do this, though.

I think that won't be a problem in our particular case. How do I do it
- add the resolver?

--
Regards,
Mike

Egon Nijns

unread,
Apr 24, 2013, 3:29:16 AM4/24/13
to simple-b...@googlegroups.com, spe...@deinprogramm.de
I'd like to know how to do this as well.

I think that ideally it should be possible to use "externalIvySettings()" and still be able to add resolvers to the chain in build.sbt

In my particular case this would allow us to use a company wide defined ivysettings.xml but still use all the SBT goodies.

Mark Harrah

unread,
Apr 24, 2013, 8:30:47 AM4/24/13
to simple-b...@googlegroups.com
<resolver ref="inter-project"/>

Mark Harrah

unread,
Apr 24, 2013, 8:31:44 AM4/24/13
to simple-b...@googlegroups.com
On Wed, 24 Apr 2013 00:29:16 -0700 (PDT)
Egon Nijns <egon....@gmail.com> wrote:

> I'd like to know how to do this as well.
>
> I think that ideally it should be possible to use "externalIvySettings()"
> and still be able to add resolvers to the chain in build.sbt
>
> In my particular case this would allow us to use a company wide defined
> ivysettings.xml but still use all the SBT goodies.

Please feel free to submit a pull request. I do not personally like merging external XML configuration with inline Scala configuration. It is difficult to get general, reasonable semantics.

-Mark

> On Wednesday, April 24, 2013 9:09:28 AM UTC+2, Michael Sperber wrote:
> >
> >
> > Mark Harrah <dmha...@gmail.com <javascript:>> writes:
> >
> > > Yes, you can add it as a resolver in your chain ("inter-project").
> > > The problem is that other tools that read the ivysettings.xml won't
> > > think it is defined. I'm not sure how else to do this, though.
> >
> > I think that won't be a problem in our particular case. How do I do it
> > - add the resolver?
> >
> > --
> > Regards,
> > Mike
> >
> >
>

Egon Nijns

unread,
Apr 26, 2013, 5:44:24 AM4/26/13
to simple-b...@googlegroups.com
Thank you for the information

Using the 'inter-project' resolver and a custom ivysettings.xml file (that includes our company wide ivysettings file + some additional resolvers) we were able to get the desired behaviour...

kind regards,
Egon.

Josh Suereth

unread,
Apr 28, 2013, 2:10:14 PM4/28/13
to simple-b...@googlegroups.com
Would you mind expanding our documentation on external ivy configuration with your use case and solution?  Or at least opening a feature request ticket that we describe the process.

I'd love it if we had this documented for future users :)

Egon Nijns

unread,
Jun 21, 2013, 3:22:50 AM6/21/13
to simple-b...@googlegroups.com
Finally I had some time to work on this again... My solution is still a bit rough around the edges.

I have some issues using
* sbt run (inter-project dependencies are missing from the classpath)
* sbt-assembly (probably caused by the missing classpath entries) - see https://groups.google.com/d/msg/simple-build-tool/IefZyErfDWQ/JfUPl0G3HQcJ
* sbteclipse (some dependencies are missing their sources)

But for people in my situation that don't mind the above problems, my configuration comes down to writing a customized ivysettings.xml file:

<ivysettings>
    <include url="http://svnserver/svn_public/trunk/ivyrepository/ivysettings.xml" />

    <settings defaultResolver="voorSBT" circularDependencyStrategy="error" defaultConflictManager="${default.conflictmanager}" />

    <resolvers>
        <chain name="voorSBT" checkmodified="true" changingPattern=".*" changingMatcher="exactOrRegexp">
            <resolver ref="inter-project"/>
            <resolver ref="uz"/>
            <ibiblio name="Default Maven repository" root="http://repo1.maven.org/maven2/" m2compatible="true"/>
            <ibiblio name="Spray repository" root="http://repo.spray.io/" m2compatible="true"/>
        </chain>
    </resolvers>
</ivysettings>

This includes the company-wide ivysettings.xml but overrides the default resolver and adds some resolvers to this chain (most notably sbt's 'inter-project' resolver)
Now I just include this customized ivysettings file in my sbt build using externalIvySettings...

Egon.

Egon Nijns

unread,
Jun 21, 2013, 5:16:59 AM6/21/13
to simple-b...@googlegroups.com

The first two issues were due to erroneous classpathConfiguration settings in my build and are now resolved locally.

I have some remaining issues with sbteclipse that I would like to report in the right place. What would that place be?

egon.

Mark Harrah

unread,
Jun 21, 2013, 8:06:07 AM6/21/13
to simple-b...@googlegroups.com
On Fri, 21 Jun 2013 02:16:59 -0700 (PDT)
Egon Nijns <egon....@gmail.com> wrote:

>
> The first two issues were due to erroneous classpathConfiguration settings
> in my build and are now resolved locally.
>
> I have some remaining issues with sbteclipse that I would like to report in
> the right place. What would that place be?

Bugs can be reported at https://github.com/typesafehub/sbteclipse. Issues can be discussed here first if you aren't sure if they are a bug or a misconfiguration or something.

-Mark
> >>>> send an email to simple-build-t...@**googlegroups.com.
> >>>> > To post to this group, send email to simple-b...@**googlegroups.com.
> >>>> > Visit this group at http://groups.google.com/**
> >>>> group/simple-build-tool?hl=en<http://groups.google.com/group/simple-build-tool?hl=en>.
> >>>>
> >>>> > For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>.
> >>>>
> >>>> >
> >>>> >
> >>>>
> >>>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "simple-build-tool" group.
> >>> To unsubscribe from this group and stop receiving emails from it, send
> >>> an email to simple-build-t...@googlegroups.com.
> >>> To post to this group, send email to simple-b...@googlegroups.com.
> >>> Visit this group at
> >>> http://groups.google.com/group/simple-build-tool?hl=en.
> >>> For more options, visit https://groups.google.com/groups/opt_out.
> >>>
> >>>
> >>>
> >>
> >>
>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-t...@googlegroups.com.
> To post to this group, send email to simple-b...@googlegroups.com.
> Visit this group at http://groups.google.com/group/simple-build-tool.
Reply all
Reply to author
Forward
0 new messages