0

I'm trying to build the latest version of JGit. I checked out the latest version from the Git repository. According to the build instructions, I installed the dependencies via Orbit. I then ran mvn clean install which was able to compile everything and run all the tests. So this was great, there were no errors, and I can find the compiled .jar files.

I then opened Eclipse and imported the projects into a working set. For some reason, there are numerous errors in the build process.

Imports cannot be resolved:

import org.apache.commons.compress.archivers.ArchiveOutputStream;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.compress.archivers.tar.TarConstants;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;

And more cannot be resolved:

import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response;

I tried installing Jetty via Eclipse (Install New Software). However, that did not resolved the issue.

Am I just not supposed to build JGit in Eclipse? All builds and testing should be done with Maven? I'm also confused as to why Jetty and Apache are being imported in some of these subprojects for JGit and they're not listed as dependencies of JGit on the wiki.

Thanks in advance.

4

2 回答 2

1

The Jetty and Compress libraries are used by part of the JGit infra, but the EGit support in Eclipse doesn't need everything that JGit has.

For example, JGit also provides a collection of command-line programs (jgit init, jgit add etc.) which are not used in Eclipse. So you need to build the 'pgm' module from MAven, but that in itself isn't used by EGit which is the UI in Eclipse. Similarly, the JGit HTTP server is useful but not required for EGit operation.

I believe the archivers are used to extract out tools via the pgm module for 'jgit archive', which extracts out the contents of a branch and generates a Zip or TGZ file on the fly.

If you don't want (or need) the pgm module (and i'd suggest possibly also avoiding the iplog as well) then you can uncomment those from the list of modules in the pom.xml file. Removing the http.server (and http.test) along with the pgm modules will probably allow you to compile without needing the Jetty and Apache compress modules.

于 2013-01-30T23:23:27.897 回答
1

The easiest way to install the dependencies is to use one of the target platforms, as described in Use a Target Platform. It includes all dependencies.

As for installing from the Orbit P2 repository, the listing there was incomplete. You also need to install "Apache Commons Compress", see updated instructions:

http://wiki.eclipse.org/EGit/Contributor_Guide#Option_2:_Install_from_Orbit_P2_Repository

Jetty can not be installed from Orbit, see here for instructions:

http://wiki.eclipse.org/EGit/Contributor_Guide#JGit_HTTP_Tests

Or again, use the target platform where Jetty is also included.

于 2013-02-01T11:55:00.070 回答