How to get sources in my project - java

I'm trying to get sources added to my project. I manually added the below repo and included an atmosphere snapshot.
<repositories>
<!-- Added to get the Atmosphere 1.1.0-SNAPSHOT, can be removed when 1.1.0 is released -->
<repository>
<id>oss.sonatype.org-snapshot</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>1.1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
I went and downloaded the .jar from here but when I add it to the "libraries" section in my Project Structure it doesn't add it as a source, but adds it under Classes.
In debugging when viewing the interface of a class, I've used the quick "Attach sources..." option at the top of the editor and navigated to the .jar with no avail.

Maven doesn't find the sources, because there are no sources of that library in that Maven repository (which i think is quite common for snapshots of a library). I downloaded one of the jars, and they contain only class files, so i'm wondering, how you can see the sources even if you attach the jar manually.

Related

Unable to add IBM db2jcc4 jar file through Maven

I am trying to access DB2 tables in a java project. I am able to access the tables when I manually added the jar files - db2jcc4.jar and db2jcc_license_cisuz.jar. No issues in accessing the tables.
But when I try to add these jar files through Maven, they won't add to the project.
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc4</artifactId>
<version>9.7.0.4</version>
</dependency>
Error Message - Missing artifact id.
Also, the latest db2jcc4.jar files (Version 11.1) are not present in Maven repository. Is there any other place I can access it from?
You have to download the right driver from IBM.
http://www-01.ibm.com/support/docview.wss?uid=swg21363866
Then install it to your local maven repository
http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html
As written in maven central repository the artifact is in another repo.
Add it to your pom and it will work.
<repositories>
<repository>
<id>Alfresco</id>
<name>Alfresco</name>
<url>https://artifacts.alfresco.com/nexus/content/repositories/public/</url>
</repository>
</repositories>
Assuming that , using share drive is the option to go.
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>licences</artifactId>
<version>0.7</version> <!-- Adjust this properly -->
<scope>system</scope>
<systemPath>R:\JDBC drivers\IBM DB2_db2_2.2.0.v20130525_0720\db2jcc_license_cisuz.jar</systemPath>
</dependency>
According to maven central repository the artifact is in another repository. Include these two in your pom.xml and it should work:
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc4</artifactId>
<version>10.1</version>
</dependency>
<repositories>
<repository>
<id>com.ibm.db2.jcc</id>
<url>https://artifacts.alfresco.com/nexus/content/repositories/public/</url>
</repository>
</repositories>

How include MapDB in a GWT project

I'm using this Guide for adding MapDb to my project.
i'm trying to make a simple user registration but i don't understand where and how i can put the lib inside my project!
Where include this code
<dependency>
<groupId>org.mapdb</groupId>
<artifactId>mapdb</artifactId>
<version>VERSION</version>
</dependency>
and this code
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.mapdb</groupId>
<artifactId>mapdb</artifactId>
<version>VERSION</version>
</dependency>
</dependencies>
i'm new with GWT and MapDB and if someone can tell me how put the libraries of MapDB with all steps it's can be very grateful!
After that i manage the data store/retrieve in the server gwt application?
While this is a very old question, I'll reply in case it's still helpful to you.
The XML configuration code you've quoted above should be inserted in a Maven POM file. Maven is a configuration management tool for Java-based projects.
If you aren't using or don't want to start using Maven, you can download the jar from Maven central and add it manually to your project.

Maven: NoClassDefFoundError of system scoped dependency

I am developing an Android project with Maven. I have a third-party jar file that I have included in a lib folder on my project root directory:
<dependency>
<groupId>com.parse</groupId>
<artifactId>parse</artifactId>
<version>1.9.2</version>
<scope>system</scope>
<systemPath>${project.basedir}\lib\Parse-1.9.2.jar</systemPath>
</dependency>
But when I install the apk in my phone, I get NoClassDefFoundError. Obviously, that class exists inside the jar.
How can I do?
Thanks.
I would suggest using one of your directories as a repository, add your jar in it, and load it the proper Maven way.
You can do this adding this to your pom.xml and putting your jar in /lib:
<repositories>
<repository>
<id>mylibid</id>
<url>file://${project.basedir}/lib</url>
</repository>
</repositories>
...
<dependencies>
...
<dependency>
<groupId>com.parse</groupId>
<artifactId>parse</artifactId>
<version>1.9.2</version>
</dependency>
...
</dependencies>
Add my two cents here, you can install the third-party into your local repository firstly and try add dependency directly.
Take your scenario as an example. Change to the folder where contains the third jar and type:
mvn install:install-file -DgroupId=com.parse -DartifactId=parse -Dversion=1.9.2 -Dpackaging=jar -Dfile=Parse-1.9.2.jar
Modify your pom.xml to add the dependency.
<dependencies>
...
<dependency>
<groupId>com.parse</groupId>
<artifactId>parse</artifactId>
<version>1.9.2</version>
</dependency>
...
</dependencies>

Why is Maven not finding this jar

I have the following JAR that my project needs so I added it to my pom.xml...
<dependency>
<groupId>org.reficio</groupId>
<artifactId>soap-builder</artifactId>
<version>1.0.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
</exclusion>
</exclusions>
</dependency>
But when I run Maven it tries to download from various repos and finally fails. It only creates a "lastUpdated" file whose contents are below..
http\://repository.jboss.org/nexus/content/groups/public-jboss/.lastUpdated=1392941827625
http\://www.terracotta.org/download/reflector/releases/.lastUpdated=1392941828195
Does anyone have any suggestions? Is this JAR simply not there anymore?
Thanks.
That artefact isn't in Maven Central (or other default repo) and so Maven won't find it automatically. The reficio/soap-ws page on Github explains:
soap-ws is not yet located in the central maven repo, thus you also have to add an additional repository to your config.
<repositories>
<repository>
<id>reficio</id>
<url>http://repo.reficio.org/maven/</url>
</repository>
</repositories>

Can't find the "org.eclipse.persistence" Maven dependency

I installed Eclipse Helios with the m2eclipse maven plugin.
I want to create an application using JPA. So, what I do is: New > Maven Project then I select the maven default archetype.
The problem is that I want to add the "org.eclipse.persistence" dependency that I can't find.
Where is it? Can we add it manually? Should I update a sort of "repository"?
Then, is it the right archetype that I'm using?
EclipseLink is not available in Maven central repository, you need to add its repository manually. For example, to use the "full" version of EclipseLink 2.0 (you didn't mention the artifact you're looking for):
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
...
</dependency>
<dependencies>
...
<repositories>
<repository>
<id>EclipseLink Repo</id>
<url>http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo</url>
</repository>
...
</repositories>
This is documented in the EclipseLink/Maven page.
Regarding the archetype you're using, it's impossible to answer without more details on the kind of project you want to create. And anyway, you can always modify the POM after the facts.
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
...
<repositories>
<repository>
<url>http://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
You can check below link. I found eclipse JARs on this link.
However, no idea about how to add it on Nexus.
http://dev.nightlabs.org/maven-repository/repo/

Categories