I am pretty new to Gradle, I followed some tutorials and read around wikis and guides but I still have some questions I couldn't clearly find an answer for.
What I'd like to have are some clarifications about Gradle and general github project dependencies.
Reading this question, he mentions the following example:
dependencies {
mavenCentral()
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
}
I get com.github.chrisbanes.actionbarpulltorefresh, it is basically com.github.username.repository, but what do exactly represent extra-abc and the +?
On the gradle irc they said the first one is the artifact and they gave me this, where it says: Dependency configurations are also used to publish files.. but I still don't get.. which files and for which purpouse you want to do that? I guess artifacts should refer to jars, but why giving it a name (extra-abc)?
+ takes the place where the version usually is, so I assume it should indicate the latest version, shouldn't it?
Moreover, is the example I pasted valid for both gradle and plain (netbeans) projects hosted on github or do we have to differentiate?
I am using Netbeans 8.02 with the gradle plugin.
Sorry for the dumb questions, but I really want to clear my doubts.
First of all, this library is NO LONGER BEING MAINTAINED. You should use the support library.
I get com.github.chrisbanes.actionbarpulltorefresh, it is basically com.github.username.repository,
It is not correct.
This library is published on Maven Central.
The com.github.chrisbanes.actionbarpulltorefresh is the groupId of the artifact that you can find on Maven.
but what do exactly represent extra-abc
The extra-abc is the name of the artifact (the name of the library...) on Maven.
Here you can find the full list.
|GroupId |ArtifactId| Latest Version|
|--------------------------------------------|----------|-----------------|
|com.github.chrisbanes.actionbarpulltorefresh|library | 0.9.9|
|com.github.chrisbanes.actionbarpulltorefresh|extra-abs | 0.9.9|
|com.github.chrisbanes.actionbarpulltorefresh|extra-abc | 0.9.9|
and the +
It indicates to gradle to use the last version.
In your case you can use one of these:
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:0.+'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:0.9.+'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:0.9.9'
Pay attention, the use of + is not in general a good idea, because you can't know what version you are using.
In this case, since the library is deprecated it is not a problem.
EDIT
If the question is how can I add a github project that is not present on the maven repo as a reference to my project then?
Pls refer to this answer:
Related
I initially created a plain Java project that followed the steps mentioned here and here but unfortunately, my project didn't work, I am getting this above error. I have not reached the step where it talks about integrating selenium.
Just to mention I used all the latest versions of the jar files as shown below.
I also got other various problems also, and to resolve them when I searched on the internet everyone was talking about the configuration inside the pom.xml file. But this file comes in the Maven project! so I converted my project to a Maven project. But that too didn't resolve my issues so I "disabled the Maven nature". No luck even after that.
currently, it is a Maven project but when I am following this step it is giving me the subject error.
This is how my package explorer look like:-
The trick is to start small with something working. And then after each change check if it still works. This will help you build an understanding of what each component and change does without overwhelming you.
Unfortunately you are following tutorials that do a whole lot at once. Try to break this down a bit. First learn about Maven, with plain Java and maybe a unit test. Then learn about how Eclipse works with Maven projects. Then use Cucumber with Maven, then add Selenium.
This may seem like a lot more work but it is faster because you'll only have to solve one problem at a time.
I don't have any tutorials for Maven or Eclipse but for Cucumber you use:
https://docs.cucumber.io/docs/guides/10-minute-tutorial/
I am using the eclipse IDE and trying to use a JAVA API.
This is the API I am trying to add. https://github.com/spoonlabs/flacoco
It says that the API is only currently available as a snapshot and gives me the details to add it as a dependency in a pom.xml file.
I am not sure how to do this in eclipse. I have downloaded the M2Eclipse plug in and tried creating a maven project by skipping the archetypes but when I add the dependency I get too many errors.
These are the errors that pop up : https://ibb.co/Y4gNnN8
I do not know to resolve the issue.
If any more details related to the error is needed,please let me know.
You project hierarchy, as well as the pom.xml setups are wrong.
At the pom.xml, change the group id to something like com.<your_name>.<porject name> then create the same package structure under src/main/java (you should end with up with something like src/main/java/com/<your_name>/<porject_name>).
This should fix whatever you're seeing now.
I know similar questions have been asked many times in the past, I'm working to try import a Github project to be a library Github Project for my existing project. I've reference to related stackoverflow solutions discussed here for the steps (visually or setting.gradle/build.gradle code solution) to import it but without any success in it.
Tried including include ':library:CanvasView' into setting.gradle and
compile project(':library:CanvasView')into build.gradle
Had error statement Error:Configuration with name 'default' not found. Tried solutions here to solve it without any success.
But for once, I've managed to gradle compile it with this statement, compile it fileTree(dir: 'library', include: ['CanvasView']) in build.gradle
To my dismay, I realize that I was not able to call the API of the library in my main project, because the java file of the imported library was marked with an red icon. Tried solutions here but isn't helping to call the API. Thanks for any help rendered!
Make sure you have the right names.
Note this is assuming you have already checkout your project from github. I usually put the projects under the same workspace directory. Like such:
-Workspace
--MyApp
--SomeLib
1.In your settings.gradle make sure you are pointing to the right place.
My example:
include ':SomeLib'
project (':SomeLib').projectDir = new File('../SomeLib/SomeLib')
2.In your build gradle make sure you are compiling the right Module name
compile project(':SomeLib')
A good check to see if you are doing things correctly at step 1. Before you go to step 2 make sure the library comes to the Project View. If it comes make sure your actual source code is there. Java classes etc. If you see that stuff then go to step 2. From step 2 you should be good. Let me know how it goes.
To be exact this is your example:
settings.gradle
include ':CanvasView'
project (':CanvasView').projectDir = new File('../CanvasView/CanvasView')
build.gradle
compile project(':CanvasView')
I'm working through this tutorial, which deals with adding a maven plugin to a java project.
I follow the tutorial smoothly to this step, where it says, that my plugin's state is STARTING instead of RESOLVED (like in the tutorial's picture):
I don't know if this has anything to do with my main problem which is the next step - Adding the plugin dependencies. There are 6 plugin dependencies shown in the tutorial, and I can only add the first three. Using the search box, I can't find these plugins:
org.eclipse.om2m.commons
org.eclipse.om2m.ipu.service
org.eclipse.om2m.core.service
I can see that the missing plugins are located in the main project (the project to which I'm adding my plugin). I probably did something wrong a long the way, so it isn't even searching for them, but since I have zero experience with plugins I don't even know where to start looking.
Can anybody shed some light on what could be the problem?
I am new to enterprise application developement and trying to create a REST server with Spring REST, JPA taking to mySQL database and Javascript on the client side. As I see loads of opensource libraries doing specific task, I started off with using 'maven project' with different 'arch type' (which is nothing but predefined POM with relevent libraries as I understand) provided by Eclipse. But I often run into version mismatch issues, in many cases found specific solution to that perticular libraries in StackOverflow or other sites.
Hence I started looking for a information these version dependancies such as, this version of JPA works with that version of Hibernate library and so on. I checked maven repository of major libraries, I did not find such information so far.
My queries are:
Where can I find these information about the versions dependancies?
Are these pre defined POM in eclipse reliable? Who owns them, where can I get last modified dates on these maven 'arch types'? (I find the ones I choose having fairly old version of libraries).
If I have to start off on my own creating a Maven dependacies, where will I get information about what are the dependent libraries, for example, if I need spring MVC, for sure it needs java servlet library. I am worried becuase the maven 'spring-mvc-jap' arch type whooping 50 libaries as dependancies.(Coming from embeded domain, I find to too hard to digest :D). So not sure if it is the right way.
Please correct if I am missing anything in my understanding.
You can find this information, if you are using maven and some IDE you can go to the dependancy and make click un > and this will show the librarys used for this dependancy or if you want to use the console you have http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html this will show the same that the IDE.
After normally in the documentation of the library used, you can find some doc about the dependancy about this.
Other solution is get the .jar and use 7zip to see the POM and know the dependancy used.
And for finish my answer if the IDE tell you that you dont have x dependancy normally you have to add this because any of the other dependancy used have it (they used only for the compiling task), but sometime somes projet change a lots of code between the version .a to .b so you will have some problem using the version .b, at this moment i didnt find one good and easy way to fix this, only using the way that i told you (only if i found some problem in the compilation)
3> I am not sure how it works in eclipse but in IntelliJ IDEA when you start using some class without proper dependency IDEA suggest you to add proper dependency automatically. The same approach should be in eclipse.