When I run lein jar, it will package my resource files in src/resources, but i expect to modify some config files after packaged. So the resource files should be exclude when lein jar, but how?
One way would be to use :jar-exclusions or :uberjar-exclusions in project.clj to exclude your config files:
;; to exclude all .conf files from jars:
:jar-exclusions [#".*\.conf"]
You could also simply not put those files in the resources directory and tell your application where to look for them using, say, an environment variable.
Related
I have a Maven Project with this folder structure (after run 'maven clean install' through jenkins):
PS: there are other files and directories inside this 'target' folder, but the ones I need are just those.
Well, for AWS deployment, I need to create a ZIP file with this exact structure (missing the 'ebs' folder):
My pipeline, in Jenkins, creates the ZIP with the jar ane 'ebs' folder inside, but I need Procfile and .ebextensions at root level, outside 'ebs' folder.
Jenkins configuration:
I also tried "ebs", "ebs/", "ebs/*" and "ebs/.". None works. What am I doing wrong? Should be simple to include files in ZIP package, but it doesnt.
To include Procfile file and .ebextensions folder inside ZIP package generated by Jenkins, the first step is to eliminate the 'ebs' folder during maven build.
With every file/directory inside target root, jenkins 'includes' configuration is: myapp.jar,Procfile,.ebextensions/**/*
I'm trying to establish if I can use mulitple .ebignore files in nested directories, or if the correct approach is to use a single .ebignore file in the root of my project.
for example:
/.ebignore # Some generic rules in here
/directory/.ebignore # Some rules specific to this directory in here
The AWS docs refer to the .ebignore file in the singluar, never plural:
You can tell the EB CLI to ignore certain files in your project
directory with a .ebignore file. This file works like a .gitignore.
When you deploy your project directory to Elastic Beanstalk and create
a new application version, the EB CLI will not include files specified
by the .ebignore in the source bundle that it creates.
So can I use multiple .ebignore files?
I am trying to create an atlassian's bamboo plugin in clojure. The jar must contains a file called atlassian-plugin.xml at top level. How can I do so with leiningen. I expect to create my jar using lein jar.
cheers!
didier
You could put atlassian-plugin.xml in src (not sub folder) or resource folder. It will be on the top level same as project.clj.
We have some 3rd-party jars checked-in to our project. We'd like to add them to the classpath. That's it. We don't want to set up a local maven repo (because that would break our 'check out and run' philosophy). Each developer would have to set up their own maven repo, distinct from the project.
Is there a way to do this or is this? Most of the answers I've seen say to set up a local maven which we don't want or need just to add a jar to a classpath.
You will need to setup a local maven repository, but that can be a simple directory, in your project directory, that you then check in to source control. (Which will maintain your 'check out and run' policy)
As of Leiningen 2.2.0 the functionality to deploy jars is built-in with the lein deploy task. So, the task has simplified from previous versions.
Create a directory inside your project called, in this example, myrepo. (The name is arbitrary)
Add a :repositories entry in your project.clj file with a path to the local directory you created.
:repositories [["localrepo1" "file:myrepo"]]
Deploy your free floating jar to the repo.
lein deploy localrepo1 com.blueant/fancypants 1.0.1 fancypants.jar
And, add your dependency to your project.clj :dependencies vector as normal.
:dependencies [[com.blueant/fancypants "1.0.1"]]
The deploy task will generate the checksums and directory structure required to to tie into the lein dependency resolution. You can verify your jar is loaded correctly with the lein deps :tree command.
Note: File paths in :repositories are formatted as URLs. So, /Users/user1/Desktop is file:///Users/user1/Desktop, and, a local directory within the project, myrepo is file:myrepo.
I'd like to elaborate on #Jared314's excellent answer that helped me as well.
Below is a script that automates the process of adding multiple jars from a local lib folder to a local repository:
#!/bin/sh
export LOCALREPO_USERNAME=
export LOCALREPO_PASSWORD=
for file in lib/*.jar
do
name=$(basename "$file")
basename=${name%.jar}
echo "Deploying $basename"
artifactId="local/$basename"
lein deploy localrepo1 $artifactId 1.0 $file
echo "[$artifactId \"1.0\"]" >> dependencies.log
done
The list of Leiningen dependencies that can be added to project.clj is stored in dependencies.log.
Before running the script, :repositories entry in project.clj has to be updated to allow for reading repository username and password from the environment:
:repositories [["localrepo1" {:url "file:myrepo"
:username :env/localrepo_username
:password :env/localrepo_password}]]
This will prevent the repository password prompt from displaying when running the script.
This question has already been answered here.
It is indeed possible, but there's a reason why maven and dependency management exists. If you have many dependencies changing versions creating a repo is the recommended approach.
As per instructions at Jclouds website, I downloaded the Lein BAT file, and also downloaded Curl to the same folder. I am working on a Windows 8 x64 PC.
Now I created a file named "project.clj" within the folder containing lein and curl.
After that, I ran the following command--
lein deps
However, all this does is create a file within following path (within the folder containing Lein and curl)--
target\scale\dependencies
The file named "dependencies" contains the following text--
([:dependencies [[org.jclouds/jclouds-all "1.5.3"] [org.jclouds.driver/jclouds-sshj "1.5.3"]]])
I am not sure what I am doing wrong here... How do I download all of the jclouds files correctly?
sorry, this was updated with lein 2. jclouds.apache.org doc is now corrected.
After creating project.clj...
Execute lein pom, then mvn dependency:copy-dependencies which will fill target/dependency with all the jclouds jars.