adding google analytics jar via SBT to scala project - scala

I want to add google analytics package/jar to a scala project with SBT. However I cannot find the URL of the project on http://mvnrepository.com/
I've also tried looking for it on google forums but to no avail.
I'm thinking of downloading the jar and adding it to sbt as an unmanaged jar. I think a jar is found at https://code.google.com/p/google-api-java-client/source/browse/com/google/apis/google-api-services-analytics/v3-1.3.3-beta?repo=mavenrepo&r=5f31c0ad06088b1762f414890cef93ba177ad4b8
but this is a maven repository. Now, instead of downloading the jar, I'd like to let SBT handle downloading of libs, but for this I need the URL of the maven repository that I just posted the link to where the google code is.
Question
Is there a way to figure out the URL to the maven repository where google analytics jar is stored (from the URL above)? Any other repository that has a copy of google analytics will also do.

I think this is what you want: http://mvnrepository.com/artifact/com.google.apis/google-api-services-analytics
In this case I just googled the artifact name ("google-api-services-analytics") but the structure of maven repositories tends to be very predictable. If you go one level up in the google code page you linked and check out maven-metadata.xml, that will tell you the group and artifact to look for in a repository.

Related

how scala know from where to download dependencies?

I'm working on scala project, where I'm using some third party libraries and those libraries are available at centralized repository (I've a url to download those).
May I know please, how scala know from where to download dependencies ? Where I can use repo url to download dependencies in scala project ?
Like in case of java, I used to mention jars repo url in setting.xml file, from where It could fetch too dependencies.

outside lib in GitHub

I just recently used Github, and when I was trying to upload my java project I realized that I was using some external libraries like apahce poi in this project, and these files have to be stored in libs for my application to function, do I need to upload these files because I realize that might violate some issues(maybe ?).
If yes, then what is the correct way to upload or maybe just post a link to those dependency
Use a tool that provides a dependency management system such as Maven or Gradle (these are both common choices in the Java ecosystem). Your project will then include a configuration file that Maven or Gradle will use to download dependencies so you don't need to distribute them with your project.

Download compile and publish from within SBT Task

I have a dependency on a project that is not published online, i need to download the Zip from github, compile it and publish local. So my dependency can be resolved.
Is there a way to do that with sbt. This code shows how to do the download part download a zip from url and extract it in resource using SBT but not the compile and publish part
Can anyone help or give pointer please.
If your purpose is only to depend on a project on github you don't need to go through all of that, you can simply directly depend on that project as in this:
https://stackoverflow.com/a/7550450/913053

Not able to understand How maven works with Spring MVC

I made a Hello word example in springMVC.Following are my steps.
1.Installed maven-eclipse integeration in eclipse.
2.Download maven and set environment variables,JAVA_HOME etc.
3.Check to see if maven is running via cmd and it is.
4.Create new maven project and in pom.xml,set spring core,web,web-mvc dependencies.
5.Create new Dynamic web project and under its properties->Deployment assembly I have added maven project.
6.Added spring jars core,mvc,web,context etc in dynamic web project lib folder.
It's all working now but I am not able to understand the working.
Before,I was trying to make it work without maven by copy and paste jars into lib,classpath,by makiing user library and adding jars to it and then add it to current project but every time it was giving some error.Sometimes it was classnotfound,sometimes it was context related.
Finally i tried this maven thing by searching some online tutorials and it works now.
But I am not able get it.Can anybody explain me in detail that how those spring jars getting picked during development and deployment.What exactly is maven doing that I was not doing before.I am in the state of total confusion.I know the flow of my mvc project(controllers,views etc.).
Maven searches the libraries (they are also called artifacts in the Maven language) in repositories. In the Maven Central Repository many libraries are hosted - http://search.maven.org/. After Maven finds the libraries in a repository, it caches them in your local repository. It is in ${userDir}/.m2 The next time, Maven will look in your local repository, instead of downloading again from the Central Repository.
P.S You can specify many other repositories different than the Central Repository. This is done in the <repositories> tag in your pom.xml. The Central Repository is always searched by default.
if you don't want use maven you have change your project setup. remove the pom.xml and copy all needed jar into the webapp/WEB-INF/libs folder.
Copy the jar from the a maven build(target folder). in this case you have all together without grabbing them one by one over then.

Get a Hudson build with Maven

I have moved to Maven recently, and since it works fine for resources up to date in some repositories, it's not obvious for non-maven ones.
I have something very simple to achieve (in the idea), but that I am unable to express so far:
I need to compile my code with a jar that can be found here:
https://hudson.eclipse.org/hudson/view/WTP/job/cbi-wtp-wst.xsl.psychopath/ws/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/target/
What do I have to put in my pom.xml to make Maven downloading the .jar + the java source + the javadoc, and eventually the other dependencies (actually IBM ICU, Xerces, JavaCup) that are mentionned in the supplied MANIFEST ?
I have read lots of documents, including those with a plugin called Tycho, but nothing helpfull for that simple task.
Thanks for your help.
Maven only works well if all artifacts needed for a build are contained in the local or a configured remote repository. So you have to do the following jobs:
Find out if eclipse plugins are deployed in a Maven2-style repository, and what the URL of that repository is.
Then find out which version of that plugin (artifact) you need.
Maven allows you to configure what will be copied locally: jar file, sources and api doc if you want to.
Maven should then be responsible to download as well all needed artifacts for the plugin you want to use.
After looking at the contents of the URL you gave us (especially the file p2content.xml), it looks like there should be a repository. I searched for the maven repository for org.eclipse.wst.xml.xpath2 and found the URL http://maven.eclipse.org/nexus/content/repositories/testing/org/eclipse/wst/org.eclipse.wst.xml.xpath2/1.1.0/org.eclipse.wst.xml.xpath2-1.1.0.pom
So the repository you are searching for is located at http://maven.eclipse.org/nexus. Just open it, search for example for xpath2, and Nexus, the repository software used there will you show the available artifacts. Depending on what was deployed to that repository, it may contain only the library, or have even sources and JavaDoc bundled with it. For the example above (xpath2), there seems to be only the POM itself and the library (the jar). If you take as example junit, you will find all versions and variants, even with sources.jar and javadoc.jar.
After you have found the needed artifact, you can include it in the dependency section of your POM. And you have to add http://maven.eclipse.org/nexus as a remote repository in the configuration of your Maven installation.
The question and its answer Get source JARs from Maven repository explain how to fetch sources and JavaDoc (if they are available).
You need a maven repository which contains this artifacts (i don't know, if Eclipse hosts a repository for their projects). You can also deploy manually the artifacts to a local repository on your computer.