I have multiple projects, an Android project and a couple of "Java Library" projects that I need to import into my main Android project.
My library uses springFramework.jar, when I include this library into my Android I get the following exception.
10-01 11:35:04.101: E/dalvikvm(1144): Could not find class 'org.springframework.web.client.RestTemplate', referenced from method com.nuvasive.shared.atlasmobile.service.ServiceClient.
If I include the jar files into my main project as well as the library everything works fine, but I rather not do that.
So there are two problems here:
Seems like jar file in my library is not being added to my main project
My main project can't access classes in my library project
What am I doing wrong here?
According to me if you have added jar files to build path(check in libraries tab) then remove them from that tab and as i can see you have not marked jars you are using in order and export please nark all jars you are using. You will see those under private libraries in libraries tab.
Try it.
I'm not entirely sure what you're trying do without knowing what 'springFramework.jar' is, what libraries you have linked in all your projects, what your code is doing, etc., but my guess is that this is some kind of dependency issue.
Check out http://mvnrepository.com/search.html?query=spring+framework+. Although this site is designed for maven dependencies, I believe you can download any of the jars directly.
'springframework.jar' is probably an older build of Spring that combined multiple components that are now broken up into different modules (spring-core, spring-jdbc, spring-web, etc.) Perhaps your main project has another needed dependency that your Android project does not?
Related
Currently, I have a few custom maven plugins which use the same libraries (JARs) as my application which uses it.
It is pertinent to mention that the libraries are also custom libraries developed by us and not 3rd party.
I want to let go of these libraries and integrate all of them directly inside my application source code - just have one problem - what do I do with
the maven plugins which use them.
Is there a way I can use the application source code (after integrating the libraries) while compiling / running the maven plugins?
Personally I wouldn't go on this path because of dependency hell etc, but if you really need to you could create a jar containing the source files (see https://maven.apache.org/plugin-developers/cookbook/attach-source-javadoc-artifacts.html) and then in the project you need to source unpack it like this https://maven.apache.org/plugins/maven-dependency-plugin/examples/using-dependencies-sources.html.
ps: what is the reason to drop the libraries and instead use the source code?
I am a new IntelliJ user (I've used Eclipse for many years). I'm having a hard time wrapping my head around the-project-is-a-module concept in IntelliJ, since this does not hold true in Eclipse. The main issue I'm having is that I am using my top level package as the project in IntelliJ. I would like this top level package to be in a git repo. I would also like all the dependencies of this package to be in their own respetive git repos. When I check these packages out into my project, a do git status on the top level package, all of the dependencies show up in the untracked files. This behavior seems incorrect to me. How can I fix it?
Thanks!
Edit:
To summarize the clarifications in the comments:
I would like to support hundreds of libraries any of which could change at a time. The dependency graph will also be frequently changing. For this reason, having one git repo or constantly updating .gitignore files is not maintainable.
Currently, I'm using Maven to manage dependencies but I'm open to using whatever is best suited for this job.
Finally, I would like to check out any library into my workspace and modify it and, if possible, have Intellij reflect my local changes when running code as if my local code were already built into the dependency graph. A type of local override if you will.
IntelliJ's directory structure places all of the modules in their parent project's directory. If you are developing libraries which are shared between several other projects, importing the library as a module is probably not the correct solution. Instead, you should treat each library as its own independent project and make "releases" using a build tool such as gradle or maven. Then your projects can treat the libraries the same way they do third-party libraries and use the build tool to import the library.
I'm working on another issue with getting my build.gradle to understand a workspace project dependency in my Android project. I've been using Java and Android for a while and I'm still easily confused about all the different ways to add a dependency. One way is to put a .jar file in the libs/ folder. Another way is to have a workspace project dependency. Another way (if working with Android) is to add a project dependency in the Android options menu? I feel like if I truly understood why there are these different dependencies and how they work maybe I wouldn't constantly have issues with managing my dependencies (even with Gradle). Why would one want a project dependency instead of a normal .jar in the libs/ folder? I'm not even sure how a project dependency itself works. By project dependency, I mean something like the Google Play Services project that I have to import into my Eclipse workspace. When importing into Eclipse it doesn't copy the actual directory into the workspace but it's more like a link to the directory. I know this is a big topic, maybe someone can show me a concise place to gain information.
Speaking in general terms, if you add a jar to lib folder, it will (usually) be packed along with the rest of your code. Project dependency adds a compile-time dependency, but (as you already said) it will not be packed into your build. However, that dependency will have to be satisfied at runtime (meaning, for example, Google Play Services will have to exist on the device that runs your code). Aside from that, gradle keeps "its own set of dependencies" to be able to build the application not depending on the IDE you are using. But most IDEs are well integrated with build tools, so they automatically synchronize dependencies between IDE project dependencies, and build tool's dependencies. I hope this makes sense :)
I'm currently building an Android library. The library is divided into two parts:
Core features and functionality
Utility classes such as extended Activities, FragmentActivities etc.
Now when I tried building the library's structure as such, including ActionBarSherlock and AppCompat V7 created a conflict for Gradle. The two libraries are mutually exclusive. My solution was to build a core library and 2 wrapper libraries (one for ABS and another for AppCompat V7) then provide the user with both options. So I did the following:
For the core library project "core" I ran the gradlew assemble command. This in turn generated an aar file for my library "core.aar".
I created another library project "support" and added the core.aar as a dependency in my local maven for that project. (More info on that here)
I ran ./gradlew assemble for the support library which in turn created support.aar.
I finally added the support.aar file as a dependency for my application (just like step 2)
When I finish all that, I get a compilation error for my app saying that certain resources cannot be found in my library files in the exploded-aar folder. To be more precise, in my library I have certain drawables that are used in certain layout files, both in the library. These are not found anywhere.
Any idea what could be causing the problem?
I have an eclipse plugin project which dependes on java project in my eclipse. usually what I did is export the project as jar and use it as-is in the plugin. but this requires manual work. can I have a reference from my plugin projct to a java project that will be both compile-time and run-time dependency ?
I saw a similar question, but not exactly the same.
I think, the closest thing to this is to create a jar file from the referenced project, and import it to the projects repository. But thats quite hard to manage for a currently developed project.
On the other hand, isn't it possible to simply convert the Java project into a plug-in permanently? If the other user does not use OSGi/Eclipse, he/she will see only a manifest/manifest.mf file (and possibly a plugin.xml) next to the java project specific stuff, so this would not disturb them, but would help you.