Share common test code between multiple packages in rust - unit-testing

I am having common functionality that I want to reuse in junit tests that live in different packages and I don't know how to do it. I've tried with different modules and libs but something is not working. My current structure looks something like this:
.
├── Cargo.lock
├── Cargo.toml
├── foo
│ └── bar
│ └── baz
│ ├── template
│ │ ├── Cargo.lock
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── tests
│ │ ├── mod.rs
│ │ └── test1.rs
│ │
│ └── template_implementation
│ ├── Cargo.lock
│ ├── Cargo.toml
│ └── src
│ └── tests
│ ├── mod.rs
│ └── test2.rs
│
└── utils
└── testpackage
├── Cargo.toml
├── lib.rs
└── common.rs
So in common.rs I have something like this:
/// setup for tests
pub fn setup() { ... }
pub fn mock_x() { ... }
pub fn mock_y() { ... }
lib.rs looks like this:
#[cfg(test)]
pub mod common;
I want to use those functions in common.rs in both test1.rs and test2.rs. I made sure dependencies are correct on the cargo files, and even though they are "found" by the IDE, I get an error when doing cargo test that the methods are not found in testpackage.
It "works" if I remove #[cfg(test)] from the mod but I don't want that to be included when doing cargo build, besides I get bunch of warnings when running the tests and it doesn't even compile the artifacts then.
I tried moving common.rs around, to include it in the template package for example but still couldn't get it work, I face similar issues. Not sure if I am missing some annotation or what, if feels like a very silly issue.
How would you do something like this?

Just a hunch (I haven't tried to recreate your folder structure there and never tried to compile a #[cfg(test)] library), but by the way it looks you're juggling three different crates in a workspace setup. In this case your testpackage would (to my understanding) only be included as a pseudo-external dependency in your template and template_implementation crates. To my understanding of the workspaces build process, workspace sub-crates will be compiled for debug or release (but never in testing configuration) for inclusion in other sub-crates of a workspace, while #[cfg(test)] is only ever used within the scope of a single crate.

Related

Can I have source code ouside project folder in xcode?

I just created my first xcode C++ project. Directory structure looks like the following:
myproject
+-xproject
+-xproject
| +-main.cpp
+-xproject.xcodeproj
Let me describe it (not sure if its necessary). The base folder is myproject, everything inside it was created by xcode.
Instead, I would like have main.cpp outside, like the following:
myproject
+-main.cpp
+-xproject
+-xproject.xcodeproj
Is that possible? How can I get things this way?
Why I want that? Because different IDEs offer different benefits (and debugging in qtcreator might be less straightforward than in xcode, How to debug C++ project using Qt Creator?)
Actually xproject.xcodeproj is a folder which contains:
xproject/xproject.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│   ├── contents.xcworkspacedata
│   ├── xcshareddata
│   │   └── IDEWorkspaceChecks.plist
│   └── xcuserdata
│   └── user.xcuserdatad
│   └── UserInterfaceState.xcuserstate
└── xcuserdata
└── user.xcuserdatad
└── xcschemes
└── xcschememanagement.plist
What I tried (looks like Eljay approach): Open project on xcode, remove xproject/main.cpp and then add myproject/main.cpp. Hit play button and it says build succedded. But also says:
Could not launch "xproject"
LLDB provided no error string.
When I click details I get:
Domain: IDEDebugSessionErrorDomain
Code: 3
Failure Reason: LLDB provided no error string.
User Info: {
DVTRadarComponentKey = 855031;
RawLLDBErrorMessage = "LLDB provided no error string.";
}
ln -s xproject/main.cpp main.cpp
Although I don't like this solution because the original file have to be inside xcode project.
I tried the oposite, but then xcode refuses to work.

Reason to add empty source file to a STATIC library?

I've seen this quite a lot in C++, that developers add an empty source file to the library in CMake. One example is here, with the empty source file found here.
The CMake file has this line:
# build the library
add_library(${PROJECT_NAME} STATIC src/dependency-tracker.cc)
This is only the case if there are no other source files in the src folder, so the library would be 'header only'. Why do they do this?
The directory structure i was referring to:
.
├── CMakeLists.txt
├── include
│   └── okvis
│   └── kinematics
│   ├── implementation
│   │   └── Transformation.hpp <- header only implementation
│   ├── operators.hpp
│   └── Transformation.hpp
├── src
│   └── dependency-tracker.cc <- empty source file
└── test
├── runTests.cpp
└── TestTransformation.cpp
The project specifies CMake 2.8.11 as a minimal requirement:
cmake_minimum_required(VERSION 2.8.11)
This version lacks for INTERFACE library type, which nowadays is a standard representation of a header-only library. (Support for INTERFACE libraries firstly appeared in CMake 3.0).
Without INTERFACE library available, a normal library with a single empty source file looks like a good alternative.
I don't know why dependency-tracker.cc name choosen for the empty source file. Probably, this name has some special meaning for the project's developers.

Error after implementing 'curl': E1696 cannot open source file "curl/curl.h"

The title says it all. I'm using VS 2019 since as far as I can understand, curl is more used on VS 2019 rather than VS Code (correct me if I'm wrong). So my project has this structure:
── myproject
├── myproject
│ ├── src
│ │ ├── main.cpp
│ ├── myproject.vcxproj
│ ├── myproject.vcxproj.filters
│ └── myproject.vcxproj.user
├── externals
│ ├── curl [SUBMODULE]
│ │ ├── include [THE INCLUDE DIRECTORY]
│ │ │ ├─ ···
│ │ ├── ···
│ ├── ···
├── .git
├── .vs
├── .gitmodules
├── myproject.sln
I added curl (see https://github.com/curl/curl) as a Git submodule in the folder ./externals/curl:
2. In my solution, I went to the project 'myproject' -> (Right Click) -> Properties -> C/C++ -> General -> Additional Include Directories and added the following line:
$(SolutionDir)externals\curl\include -> Apply -> OK
I went to ./src/main.cpp and pressed View Code (F7), then added the line #include "curl/curl.h". But even after doing steps 1 and 2, VS 2019 won't detect the curl headers:
Consequently obtaining that error.
(Thanks to #drescherjm)
All you have to do is ensure you have applied the change in step #2 for all the configurations and platforms (go to the project 'myproject' -> (Right Click) -> Properties -> C/C++ -> General -> Additional Include Directories; in the top of the window, set 'Configurations' to "All Configurations" as well as 'Platforms' to "All Platforms"). See Image
You may want to apply these Include Directories only to one (or a few) of the configurations and/or platforms, so once you're done just set that(those) configuration(s) on your Visual Studio IDE.

local socket = require("socket"), module 'socket' not found

Im using Lua with C++ in a project in Visual Studio 2015. I have used Luarocks to create socket/core.dll and mime/core.dll. I have added the core.dll to the debug folder where my C++ program executes. The error I get in lua is generated when "require("socket")" executes. The following error is what I get:
...s\Visual Studio 2015\Projects\RaceGame3\Debug\Client.lua:17: module
'socket' not found:
no field package.preload['socket']
no file 'C:\Users\Username\Documents\Visual Studio
2015\Projects\RaceGame3\Debug\lua\socket.lua'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\lua\socket\init.lua'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\socket.lua'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\socket\init.lua'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\..\share\lua\5.3\socket.lua'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\..\share\lua\5.3\socket\init.lua'
no file '.\socket.lua'
no file '.\socket\init.lua'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\socket.dll'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\..\lib\lua\5.3\socket.dll'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\loadall.dll'
no file '.\socket.dll'
So to sum up: How do I correctly link the core.dll or other luasocket files to my current Lua instance while running the C++ project?
I've solved a similar issue by changing the require to:
require("socket.core")
That only works, of course, if you have the core.dll inside a folder named socket that can be found locally or in your PATH / package.cpath, etc..
You could also rename core.dll to socket.dll (and place it in a searchable folder).
The problem, as far as I know, is: the required name and the actual dll name simply doesn't match.
edit: To play safe, I've put the lua modules and the dll together, locally, like this:
socket
├── core.dll
├── ltn12.lua
├── mime.lua
├── mime-1.0.3.dll
├── socket
│   ├── ftp.lua
│   ├── headers.lua
│   ├── http.lua
│   ├── smtp.lua
│   ├── tp.lua
│   └── url.lua
└── socket.lua
You were in a very similar situation to me. In my case, I required socket.http in sample.lua,
require("socket.http")
content, status, header = socket.http.request("http://website.com/aaa.php")
and have met the following error message:
...\MyProject\Release\sample.lua:1: module 'socket.http' not found:
no field package.preload['socket.http']
no file '.\socket\http.lua'
(...)
I've addressed this issue by putting some necessary lua scripts and dll files in the path where a sample executable is located.
Release
├── socket
│ ├── ftp.lua
│ ├── http.lua
│ ├── smtp.lua
│ ├── tp.lua
│ └── url.lua
├── mime
│ └── core.dll
├── ltn12.lua
├── mime.lua
├── socket.dll <--- renamed from $(LUA_PATH)\clibs\socket\core.dll
├── socket.lua
├── lua5.1.dll
├── sample.exe
└── sample.lua
The cpp code is as follows:
#pragma comment(lib, "lua5.1.lib")
#include <lua.hpp>
void main() {
lua_State *L = luaL_newstate();
luaL_openlibs(L);
luaL_dofile(L, "sample.lua");
lua_close(L);
}

Leiningen can't locate local dependency

I'm having problems using a local version of a library which I don't want to push up to Clojars to test and find out it's broken. I appreciate this is a common problem for lots of devs new to Clojure and Leiningen. I've followed the steps provided by others and it still doesn't work.
In summary:
I've tried lein pom/jar/install, as well as the checkout feature (where you symlink your other project). I think there is a source-paths option I could try, but I'm not sure how that works. I also thought about trying to modify the lein classpath but I'm not sure if that's possible?
For those of you who prefer much more detail...
I have two Leiningen projects:
https://github.com/Integralist/spurious-clojure-aws-sdk-helper
https://github.com/Integralist/spurious-clojure-example
The idea is that the second project "spurious-clojure-example" should use the first "spurious-clojure-aws-sdk-helper" as a dev dependency (as it's a library you use while local dev'ing against faked AWS resources; so no need to use it in a production environment).
The "spurious-clojure-example" project.clj file looks like...
(defproject spurious-clojure-example "0.1.0"
:description "This is an example application that utilises the Spurious Clojure AWS SDK Helper"
:url "https://github.com/integralist/spurious-clojure-example"
:dependencies [[org.clojure/clojure "1.6.0"]
[compojure "1.1.6"]
[hiccup "1.0.5"]
[ring-server "0.3.1"]
[amazonica "0.3.13"]
[environ "1.0.0"]]
:plugins [[lein-ring "0.8.12"]
[lein-environ "1.0.0"]]
:ring {:handler spurious-clojure-example.handler/app
:init spurious-clojure-example.handler/init
:destroy spurious-clojure-example.handler/destroy}
:profiles
{:uberjar {:aot :all}
:production
{:ring
{:open-browser? false, :stacktraces? false, :auto-reload? false}}
:dev
{:dependencies [[ring-mock "0.1.5"]
[ring/ring-devel "1.3.1"]
[spurious-aws-sdk-helper "0.1.0"]]}})
Notice I've put [spurious-aws-sdk-helper "0.1.0"] into :dev {:dependencies}.
The way the "spurious-clojure-aws-sdk-helper" code gets loaded is like so:
(if (env :debug) ; defined in profiles.clj
(do
(require '[spurious-aws-sdk-helper.core :as core])
(...other stuff...)))
The first thing I tried within my "spurious-aws-sdk-helper" project was...
lein pom
lein jar
lein install
...as I was told this would install "spurious-aws-sdk-helper" into the local directory ~/.m2 which Leiningen would look at first as a local cache of remote dependencies.
tree ~/.m2 | grep spurious
├── spurious-aws-sdk-helper
│   └── spurious-aws-sdk-helper
│   │   ├── spurious-aws-sdk-helper-0.1.0.jar
│   │   └── spurious-aws-sdk-helper-0.1.0.pom
│   │   ├── spurious-aws-sdk-helper-0.1.0-SNAPSHOT.jar
│   │   └── spurious-aws-sdk-helper-0.1.0-SNAPSHOT.pom
├── spurious-clojure-example
│   └── spurious-clojure-example
│   │   ├── spurious-clojure-example-0.1.0-SNAPSHOT.jar
│   │   └── spurious-clojure-example-0.1.0-SNAPSHOT.pom
This didn't work. When I connect my Vim editor to an nREPL and try to evaluate the require call to the library it would say it couldn't find the namespace.
I then tried doing the same lein pom/jar/install process for my "spurious-clojure-example" project (just in case there was some strange reason both projects needed to be locally installed). Again, no difference either, but i wasn't expected this to do anything really.
I then tried renaming my projects to remove the -SNAPSHOT from the version number (in case that made Leiningen think the dependency couldn't be used - nonsense I know, but I was clutching at straws).
I moved onto trying out the checkout feature (https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#checkout-dependencies) and when I evaluated the require call, that would pass through (e.g. no errors) but then one of the dependencies used by "spurious-aws-sdk-helper" would fail to load (i.e. org.clojure/data.json).
As a temporary measure I decided to add org.clojure/data.json to my "spurious-clojure-example" dependencies. So when evaluating the code again in the REPL, it this time got past the first two namespace errors but then it again errored because the spurious-aws-sdk-helper.s3 namespace couldn't be found :-/
At this point I realised I must be missing something really obvious, because it should not be this hard to test a library locally on your computer.
Could someone help me to resolve this problem.
Many thanks!
UPDATE: here is the result of lein classpath for "spurious-clojure-example"...
/Users/markmcdonnell/Code/spurious-clojure-example/test
/Users/markmcdonnell/Code/spurious-clojure-example/src
/Users/markmcdonnell/Code/spurious-clojure-example/dev-resources
/Users/markmcdonnell/Code/spurious-clojure-example/resources
/Users/markmcdonnell/Code/spurious-clojure-example/target/classes
/Users/markmcdonnell/.m2/repository/ns-tracker/ns-tracker/0.2.1/ns-tracker-0.2.1.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.macro/0.1.0/tools.macro-0.1.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-sqs/1.9.13/aws-java-sdk-sqs-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-s3/1.9.13/aws-java-sdk-s3-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-dynamodb/1.9.13/aws-java-sdk-dynamodb-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-swf-libraries/1.9.13/aws-java-sdk-swf-libraries-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/clojure/algo.generic/0.1.2/algo.generic-0.1.2.jar
/Users/markmcdonnell/.m2/repository/org/clojure/java.classpath/0.2.0/java.classpath-0.2.0.jar
/Users/markmcdonnell/.m2/repository/watchtower/watchtower/0.1.1/watchtower-0.1.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-config/1.9.13/aws-java-sdk-config-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-redshift/1.9.13/aws-java-sdk-redshift-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar
/Users/markmcdonnell/.m2/repository/clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-glacier/1.9.13/aws-java-sdk-glacier-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk/1.9.13/aws-java-sdk-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-directconnect/1.9.13/aws-java-sdk-directconnect-1.9.13.jar
/Users/markmcdonnell/.m2/repository/ring/ring-codec/1.0.0/ring-codec-1.0.0.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-server/7.6.8.v20121106/jetty-server-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/joda-time/joda-time/2.2/joda-time-2.2.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-ec2/1.9.13/aws-java-sdk-ec2-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-continuation/7.6.8.v20121106/jetty-continuation-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-lambda/1.9.13/aws-java-sdk-lambda-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-storagegateway/1.9.13/aws-java-sdk-storagegateway-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-ses/1.9.13/aws-java-sdk-ses-1.9.13.jar
/Users/markmcdonnell/.m2/repository/clj-stacktrace/clj-stacktrace/0.2.5/clj-stacktrace-0.2.5.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-opsworks/1.9.13/aws-java-sdk-opsworks-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-core/1.9.13/aws-java-sdk-core-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-util/7.6.8.v20121106/jetty-util-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/ring/ring-servlet/1.2.1/ring-servlet-1.2.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-simpleworkflow/1.9.13/aws-java-sdk-simpleworkflow-1.9.13.jar
/Users/markmcdonnell/.m2/repository/clj-time/clj-time/0.4.4/clj-time-0.4.4.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-logs/1.9.13/aws-java-sdk-logs-1.9.13.jar
/Users/markmcdonnell/.m2/repository/robert/hooke/1.3.0/hooke-1.3.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudsearch/1.9.13/aws-java-sdk-cloudsearch-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-simpledb/1.9.13/aws-java-sdk-simpledb-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudfront/1.9.13/aws-java-sdk-cloudfront-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-sts/1.9.13/aws-java-sdk-sts-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-codedeploy/1.9.13/aws-java-sdk-codedeploy-1.9.13.jar
/Users/markmcdonnell/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-kinesis/1.9.13/aws-java-sdk-kinesis-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-autoscaling/1.9.13/aws-java-sdk-autoscaling-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/amazon-kinesis-client/1.1.0/amazon-kinesis-client-1.1.0.jar
/Users/markmcdonnell/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
/Users/markmcdonnell/.m2/repository/ring/ring-jetty-adapter/1.2.1/ring-jetty-adapter-1.2.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-support/1.9.13/aws-java-sdk-support-1.9.13.jar
/Users/markmcdonnell/.m2/repository/commons-fileupload/commons-fileupload/1.3/commons-fileupload-1.3.jar
/Users/markmcdonnell/.m2/repository/hiccup/hiccup/1.0.5/hiccup-1.0.5.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elasticbeanstalk/1.9.13/aws-java-sdk-elasticbeanstalk-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.reader/0.7.3/tools.reader-0.7.3.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cognitoidentity/1.9.13/aws-java-sdk-cognitoidentity-1.9.13.jar
/Users/markmcdonnell/.m2/repository/ring-refresh/ring-refresh/0.1.2/ring-refresh-0.1.2.jar
/Users/markmcdonnell/.m2/repository/org/tukaani/xz/1.5/xz-1.5.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudwatch/1.9.13/aws-java-sdk-cloudwatch-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-rds/1.9.13/aws-java-sdk-rds-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-importexport/1.9.13/aws-java-sdk-importexport-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudformation/1.9.13/aws-java-sdk-cloudformation-1.9.13.jar
/Users/markmcdonnell/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-route53/1.9.13/aws-java-sdk-route53-1.9.13.jar
/Users/markmcdonnell/.m2/repository/ring/ring/1.2.1/ring-1.2.1.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.namespace/0.1.3/tools.namespace-0.1.3.jar
/Users/markmcdonnell/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.3.2/jackson-databind-2.3.2.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elastictranscoder/1.9.13/aws-java-sdk-elastictranscoder-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elasticache/1.9.13/aws-java-sdk-elasticache-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/iq80/snappy/snappy/0.3/snappy-0.3.jar
/Users/markmcdonnell/.m2/repository/ring/ring-devel/1.2.1/ring-devel-1.2.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-kms/1.9.13/aws-java-sdk-kms-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-emr/1.9.13/aws-java-sdk-emr-1.9.13.jar
/Users/markmcdonnell/.m2/repository/clout/clout/1.1.0/clout-1.1.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudwatchmetrics/1.9.13/aws-java-sdk-cloudwatchmetrics-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.nrepl/0.2.6/tools.nrepl-0.2.6.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elasticloadbalancing/1.9.13/aws-java-sdk-elasticloadbalancing-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-iam/1.9.13/aws-java-sdk-iam-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-datapipeline/1.9.13/aws-java-sdk-datapipeline-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/orbit/javax.servlet/2.5.0.v201103041518/javax.servlet-2.5.0.v201103041518.jar
/Users/markmcdonnell/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-sns/1.9.13/aws-java-sdk-sns-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudtrail/1.9.13/aws-java-sdk-cloudtrail-1.9.13.jar
/Users/markmcdonnell/.m2/repository/environ/environ/1.0.0/environ-1.0.0.jar
/Users/markmcdonnell/.m2/repository/net/jpountz/lz4/lz4/1.2.0/lz4-1.2.0.jar
/Users/markmcdonnell/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.3.2/jackson-core-2.3.2.jar
/Users/markmcdonnell/.m2/repository/compojure/compojure/1.1.6/compojure-1.1.6.jar
/Users/markmcdonnell/.m2/repository/ring-server/ring-server/0.3.1/ring-server-0.3.1.jar
/Users/markmcdonnell/.m2/repository/com/taoensso/nippy/2.7.0/nippy-2.7.0.jar
/Users/markmcdonnell/.m2/repository/amazonica/amazonica/0.3.13/amazonica-0.3.13.jar
/Users/markmcdonnell/.m2/repository/ring/ring-core/1.2.1/ring-core-1.2.1.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-io/7.6.8.v20121106/jetty-io-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-http/7.6.8.v20121106/jetty-http-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/org/clojure/core.incubator/0.1.0/core.incubator-0.1.0.jar
/Users/markmcdonnell/.m2/repository/com/taoensso/encore/1.11.2/encore-1.11.2.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cognitosync/1.9.13/aws-java-sdk-cognitosync-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.3.0/jackson-annotations-2.3.0.jar
UPDATE 2:
/Users/markmcdonnell/.m2
└── repository
├── amazonica
├── ant
├── antlr
├── aopalliance
├── args4j
├── asm
├── bbc
├── bidi
├── bouncycastle
├── ch
├── cheshire
├── circleci
├── classworlds
├── clj-stacktrace
├── clj-time
├── clojure-complete
├── clout
├── co
├── com
├── commons-beanutils
├── commons-cli
├── commons-codec
├── commons-collections
├── commons-digester
├── commons-discovery
├── commons-el
├── commons-fileupload
├── commons-httpclient
├── commons-io
├── commons-jelly
├── commons-jexl
├── commons-lang
├── commons-logging
├── commons-net
├── commons-validator
├── compojure
├── compojure-app
├── crypto-equality
├── crypto-random
├── de
├── dom4j
├── dotenv
├── doxia
├── environ
├── findbugs
├── geronimo-spec
├── hiccup
├── http-kit
├── instaparse
├── jackmorrill
├── javax
├── jaxen
├── jdom
├── jfree
├── jline
├── joda-time
├── junit
├── juxt
├── lein-dotenv
├── lein-environ
├── lein-ring
├── leinjacker
├── local
├── log4j
├── medley
├── modular
├── mx4j
├── nekohtml
├── net
├── ns-tracker
├── org
├── oro
├── pathetic
├── plexus
├── potemkin
├── prismatic
├── qdox
├── ring
├── ring-mock
├── ring-refresh
├── ring-server
├── robert
├── spurious-aws-sdk-helper
├── stax
├── thneed
├── tigris
├── trammel
├── velocity
├── watchtower
├── xalan
├── xerces
├── xml-apis
├── xom
└── xpp3
95 directories, 0 files
UPDATE 3: lein with-profile +dev classpath
/Users/markmcdonnell/Code/spurious-clojure-example/test
/Users/markmcdonnell/Code/spurious-clojure-example/src
/Users/markmcdonnell/Code/spurious-clojure-example/dev-resources
/Users/markmcdonnell/Code/spurious-clojure-example/resources
/Users/markmcdonnell/Code/spurious-clojure-example/target/classes
/Users/markmcdonnell/.m2/repository/ns-tracker/ns-tracker/0.2.1/ns-tracker-0.2.1.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.macro/0.1.0/tools.macro-0.1.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-sqs/1.9.13/aws-java-sdk-sqs-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-s3/1.9.13/aws-java-sdk-s3-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-dynamodb/1.9.13/aws-java-sdk-dynamodb-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-swf-libraries/1.9.13/aws-java-sdk-swf-libraries-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/clojure/algo.generic/0.1.2/algo.generic-0.1.2.jar
/Users/markmcdonnell/.m2/repository/org/clojure/java.classpath/0.2.0/java.classpath-0.2.0.jar
/Users/markmcdonnell/.m2/repository/watchtower/watchtower/0.1.1/watchtower-0.1.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-config/1.9.13/aws-java-sdk-config-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-redshift/1.9.13/aws-java-sdk-redshift-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar
/Users/markmcdonnell/.m2/repository/clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-glacier/1.9.13/aws-java-sdk-glacier-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk/1.9.13/aws-java-sdk-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-directconnect/1.9.13/aws-java-sdk-directconnect-1.9.13.jar
/Users/markmcdonnell/.m2/repository/ring/ring-codec/1.0.0/ring-codec-1.0.0.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-server/7.6.8.v20121106/jetty-server-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/joda-time/joda-time/2.2/joda-time-2.2.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-ec2/1.9.13/aws-java-sdk-ec2-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-continuation/7.6.8.v20121106/jetty-continuation-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-lambda/1.9.13/aws-java-sdk-lambda-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-storagegateway/1.9.13/aws-java-sdk-storagegateway-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-ses/1.9.13/aws-java-sdk-ses-1.9.13.jar
/Users/markmcdonnell/.m2/repository/clj-stacktrace/clj-stacktrace/0.2.5/clj-stacktrace-0.2.5.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-opsworks/1.9.13/aws-java-sdk-opsworks-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-core/1.9.13/aws-java-sdk-core-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-util/7.6.8.v20121106/jetty-util-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/ring/ring-servlet/1.2.1/ring-servlet-1.2.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-simpleworkflow/1.9.13/aws-java-sdk-simpleworkflow-1.9.13.jar
/Users/markmcdonnell/.m2/repository/clj-time/clj-time/0.4.4/clj-time-0.4.4.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-logs/1.9.13/aws-java-sdk-logs-1.9.13.jar
/Users/markmcdonnell/.m2/repository/robert/hooke/1.3.0/hooke-1.3.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudsearch/1.9.13/aws-java-sdk-cloudsearch-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-simpledb/1.9.13/aws-java-sdk-simpledb-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudfront/1.9.13/aws-java-sdk-cloudfront-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-sts/1.9.13/aws-java-sdk-sts-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-codedeploy/1.9.13/aws-java-sdk-codedeploy-1.9.13.jar
/Users/markmcdonnell/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-kinesis/1.9.13/aws-java-sdk-kinesis-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-autoscaling/1.9.13/aws-java-sdk-autoscaling-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/amazon-kinesis-client/1.1.0/amazon-kinesis-client-1.1.0.jar
/Users/markmcdonnell/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
/Users/markmcdonnell/.m2/repository/ring/ring-jetty-adapter/1.2.1/ring-jetty-adapter-1.2.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-support/1.9.13/aws-java-sdk-support-1.9.13.jar
/Users/markmcdonnell/.m2/repository/commons-fileupload/commons-fileupload/1.3/commons-fileupload-1.3.jar
/Users/markmcdonnell/.m2/repository/hiccup/hiccup/1.0.5/hiccup-1.0.5.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elasticbeanstalk/1.9.13/aws-java-sdk-elasticbeanstalk-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.reader/0.7.3/tools.reader-0.7.3.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cognitoidentity/1.9.13/aws-java-sdk-cognitoidentity-1.9.13.jar
/Users/markmcdonnell/.m2/repository/ring-refresh/ring-refresh/0.1.2/ring-refresh-0.1.2.jar
/Users/markmcdonnell/.m2/repository/org/tukaani/xz/1.5/xz-1.5.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudwatch/1.9.13/aws-java-sdk-cloudwatch-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-rds/1.9.13/aws-java-sdk-rds-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-importexport/1.9.13/aws-java-sdk-importexport-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudformation/1.9.13/aws-java-sdk-cloudformation-1.9.13.jar
/Users/markmcdonnell/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-route53/1.9.13/aws-java-sdk-route53-1.9.13.jar
/Users/markmcdonnell/.m2/repository/ring/ring/1.2.1/ring-1.2.1.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.namespace/0.1.3/tools.namespace-0.1.3.jar
/Users/markmcdonnell/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.3.2/jackson-databind-2.3.2.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elastictranscoder/1.9.13/aws-java-sdk-elastictranscoder-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elasticache/1.9.13/aws-java-sdk-elasticache-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/iq80/snappy/snappy/0.3/snappy-0.3.jar
/Users/markmcdonnell/.m2/repository/ring/ring-devel/1.2.1/ring-devel-1.2.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-kms/1.9.13/aws-java-sdk-kms-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-emr/1.9.13/aws-java-sdk-emr-1.9.13.jar
/Users/markmcdonnell/.m2/repository/clout/clout/1.1.0/clout-1.1.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudwatchmetrics/1.9.13/aws-java-sdk-cloudwatchmetrics-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.nrepl/0.2.6/tools.nrepl-0.2.6.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elasticloadbalancing/1.9.13/aws-java-sdk-elasticloadbalancing-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-iam/1.9.13/aws-java-sdk-iam-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-datapipeline/1.9.13/aws-java-sdk-datapipeline-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/orbit/javax.servlet/2.5.0.v201103041518/javax.servlet-2.5.0.v201103041518.jar
/Users/markmcdonnell/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-sns/1.9.13/aws-java-sdk-sns-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudtrail/1.9.13/aws-java-sdk-cloudtrail-1.9.13.jar
/Users/markmcdonnell/.m2/repository/environ/environ/1.0.0/environ-1.0.0.jar
/Users/markmcdonnell/.m2/repository/net/jpountz/lz4/lz4/1.2.0/lz4-1.2.0.jar
/Users/markmcdonnell/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.3.2/jackson-core-2.3.2.jar
/Users/markmcdonnell/.m2/repository/compojure/compojure/1.1.6/compojure-1.1.6.jar
/Users/markmcdonnell/.m2/repository/ring-server/ring-server/0.3.1/ring-server-0.3.1.jar
/Users/markmcdonnell/.m2/repository/com/taoensso/nippy/2.7.0/nippy-2.7.0.jar
/Users/markmcdonnell/.m2/repository/amazonica/amazonica/0.3.13/amazonica-0.3.13.jar
/Users/markmcdonnell/.m2/repository/ring/ring-core/1.2.1/ring-core-1.2.1.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-io/7.6.8.v20121106/jetty-io-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-http/7.6.8.v20121106/jetty-http-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/org/clojure/core.incubator/0.1.0/core.incubator-0.1.0.jar
/Users/markmcdonnell/.m2/repository/com/taoensso/encore/1.11.2/encore-1.11.2.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cognitosync/1.9.13/aws-java-sdk-cognitosync-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.3.0/jackson-annotations-2.3.0.jar
Justin Smith from the #clojure irc channel helped me to resolve this issue.
It seems that just running lein install was enough, but the real issue was that the error I was seeing about the namespace not being found was actually misleading as there were errors within my helper library that needed to be fixed first before I could load it successfully in my example application.
The advice was to test thoroughly within the REPL (e.g. attempt to load the helper namespace within the helper's own REPL and if it doesn't work then run a linter to verify there is no issues with the code itself).
lein install is the correct approach, but you must have some inconsistency in naming or versions.
It can be helpful to show the classpath that leiningen is actually using:
lein classpath
Or with a profile (the +dev means default +dev):
lein with-profile +dev classpath
You should find the library somewhere under ~/.m2 listed in the output.
lein deps :tree is similar and you may find it easier to find the inconsistency via that.
I had essentially the same issue, could not deal with it for 1.5 days...
The solution involved:
Getting the groupid/artifactid dependancies right in all project.clj files and in the namespace declarations.
There was an unused test file in the library project that had a reference to another charting library which was not declared in the project.clj file. The project compiled and installed without this charting lib declaration. However, referencing this lib using the local repo did not work until I removed this test file (or included the needed charting lib dependency in its project.clj)
I had to remove both of these manual local repository declarations from project.clj files:
:local-repo "file:/home/atmamta/.m2/repository/"
:repositories [["local" "file:/home/atmamta/.m2/repository/"]]
Uninstalled cider snapshot version and its dependent emacs libraries, reinstalled them using the latest stable versions, and modified my ~/.lein/profiles.clj to reflect these changes.
I.e. I changed the [cider/cider-nrepl "SNAPSHOT-x.y.z"] line to [cider/cider-nrepl "0.8.2"] in {:user {:plugins ...}} in file ~/.lein/profiles.clj
Important: cider version has to be the same as cider-nrepl version.