I've applied a git patch on my local repository to get some changes from my fellow-developer. The patch was successfully applied, and I see the changes to the java files.
I did a 'mvn clean install' on the project, it did build successfully but the changes is not visible to another java class which depends on the new changes(this jar).
When I extracted the jar and decompiled the class file I found the changes are not part of the compiled class. Could not understand this behaviour.
in simple words .. the java files has got the new changes but the generated JAR does not have the changes.
Need some advice if someone has faced this issue.
Thankyou... Found the issue, the local git repo had an issue, there were hidden files in the same repo that was causing this issue, I deleted my local repo and re-cloned it, its working now.
Related
I am writing an automated testing project for school using maven and I need to implement CI to our project. Since Gitlab has its own CI, I decided to use it.
The problem is that the project itself is inside of a folder in a Gitlab repository. I created a branch for that project, but the branch main body includes the project folder, so when I create a gitlab-ci.yml file, it cannot find the POM.xml file in the folder. So my question is that is there a way to make the yml file recognize the POM file by adding some sort of variable to it?
I know there are "only:" and "changes:" keywords for the yml file but that doesn't seem like it will help recognize the pom file. Also manually pushing a yml file that is inside of the project folder does not help. I haven't tried moving the POM file because the project grade is also dependent on the quality of our commits, so I would rather not commit wildly.
Using
- mvn -f project/pom.xml compile
instead of -mvn compile in the build: section of the .yml file solved it for me. I was blind and didn't see that there was a help section in the log that already answered my question.
I have a Leiningen project that is dependent on another Leiningen project. Both are on Github. I cloned the project I am dependent on to the checkouts folder as a Git submodule, which works great in my development environment. I can use the classes from the dependency without even having to add it as a dependency in projects.clj (despite the fact that the documentation says "If you have a project in checkouts without putting it in :dependencies then its source will be visible but its dependencies will not be found").
The main problem is that when I push the project to Heroku, the submodules are cloned automatically but there is no checkouts directory under /app. I guess that Heroku ignores checkouts for some reason.
Presumably I am doing this wrong and there's a right way for me to work in parallel with two Git repos, one of which is dependent on the other. The main issue for me is that I need to be able to deploy my app easily to Heroku. What is the standard way to deal with this situation?
Update: I also noticed that my circle.yml file, which is in the repo, is not in the /app directory. I'm totally confused about what exactly is in the /app directory and where the other stuff disappeared to.
The problem is that heroku runs lein with-profile production compile :all which ignores checkout dependencies (see https://github.com/technomancy/leiningen/issues/1263).
A possible solution is to add :checkout-deps-shares [:source-paths] to your production profile. It's discouraged (according to heroku engineers you really should use an uberjar in production) but it should do the trick.
I'm currently using svn, and I'm using git-svn to checkout the project. I then tried to import the project into Intellij, and it kinda worked, but all the .iml files were red in color (don't know why, no errors as far as I could see).
I then tried what was suggested in this post -
Import an existing Git repository into IntelliJ IDEA
ie, opening the directory as a project and configuring the git root, same problem again.
When I try compiling the project I get manifest errors that just says - -manifest while reading manifest file(invalid header field)
My project is a multi-module maven project. Any ideas would be helpful cuz I'm stumped!
With IntelliJ, you should see those same red files in the Local Changes view:
Except this time, those red files are clearly listed under the "Unversioned file" section, which shows this is not a compilation error, but a VCS code color convention.
I compiled a jar file in one project so it can be consumed in the 2nd one. I can see the jar file in .m2 folder. But in the 2nd project it complains about artifact not found.
I guess I have to force maven to update indices/cache something but don't know what exactly. Any tip, thanks.
Update: thanks for all good suggestions.
Turns out that the maven plugin (of IntelliJ) in the second project doesn't update its index. I use command line it compiled ok.
try using -U (aka --update-snapshots) when you run maven
And make sure the dependency definition is correct
You can also use this command on the command line:
mvn dependency:purge-local-repository clean install
If you are installing into local repository, there is no special index/cache update needed.
Make sure that:
You have installed the first artifact in your local repository properly. Simply copying the file to .m2 may not work as expected. Make sure you install it by mvn install
The dependency in 2nd project is setup correctly. Check on any typo in groupId/artifactId/version, or unmatched artifact type/classifier.
Even though this is an old question, I 've stumbled upon this issue multiple times and until now never figured out how to fix it. The update maven indices is a term coined by IntelliJ, and if it still doesn't work after you've compiled the first project, chances are that you are using 2 different maven installations.
Press CTRL+Shift+A to open up the Actions menu. Type Maven and go to Maven Settings. Check the Home Directory to use the same maven as you use via the command line
Click settings and search for "Repositories", then select the local repo and click "Update". That's all. This action meets my need.
If you are struggling with authenticating to a site, and Maven is caching the results, simply removing the meta-data about the site from the meta-data stash will force Maven to revisit the site.
gvim <local-git-repository>/commons-codec/resolver-status.properties
I realize that this question is pretty much the exact question found here. However, seeing as that question is 1.5 years old (or so), I would like to revisit it. How does one add local dependencies using leiningen? Surely this capability must exist by now?
Create a private Maven Repository, and then, add the following to your project.clj
:repositories {"local" ~(str (.toURI (java.io.File. "your_local_repository")))}
If the jars are based on your own projects, you can use lein install to put them into your local .m2, or use the checkout-dependencies feature.
You can also use the extra-classpaths feature, etc.
I found that the easiest (albeit somewhat hacky) solution is to do the following:
For an existing project that you're using as a dependency:
In your local project that has the dependency you want to modify, ensure you run lein deps
Clone the repo of this dependency so you can modify it locally (obv. make sure you're using the same tag as the version you specify in your project.clj file)
Run lein uberjar in this dependency dir (where the relevant project.clj file lives)
Copy the generated standalone jar in target/ to the exact path/file of your local maven files... (something like: ~/.m2/repository/project/.../file.jar); Ensure that you backup the original jar file so you can restore it later on if that is desirable
For development of your own project:
Within the project or plugin you're developing, simply run lein install
Find out where your local maven repo is (see above for an example path)
Enter dependency information in your test project like you would for any other leiningen project
Again, this is a quick hack and perhaps not the way you'd go about doing serious local development, but I found it easy enough for what I wanted. Check out lein help tutorial for much more info