Skip to content

Commit

Permalink
[FAB-6939] Eclipse Setup Instructions
Browse files Browse the repository at this point in the history
Instructions on how to setup Eclipse with the
Java SDK

Change-Id: Ibc663163c0ae3b5d010d68b701bbb3455bfb75c6
Signed-off-by: Saad Karim <skarim@us.ibm.com>
  • Loading branch information
Saad Karim committed Dec 5, 2017
1 parent c8cd86b commit 213edec
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ your server(s) hostname(s) and port(s).
Go lang chaincode dependencies must be contained in vendor folder.
For an explanation of this see [Vendor folder explanation](https://blog.gopheracademy.com/advent-2015/vendor-folder/)

### Setting Up Eclipse

To get started using the Fabric Java SDK with Eclipse, refer to the instructions at: ./docs/EclipseSetup.md

## Basic Troubleshooting

Expand Down
4 changes: 4 additions & 0 deletions checkstyle-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
<property name="checkFormat" value="$1"/>
</module>

<module name="SuppressionFilter">
<property name="file" value="suppressions.xml" />
</module>

<module name="TreeWalker">

<!-- Required for SuppressionCommentFilter module -->
Expand Down
40 changes: 40 additions & 0 deletions docs/EclipseSetup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Eclipse Setup Instructions

## Pre-req

The following dependencies must be met:

* JDK 1.8 or above
* Apache Maven

Set your JAVA\_HOME points to your installation of JDK 1.8 (or above) and make sure that JAVA_HOME/bin and Apache maven are in your PATH.

## Eclipse Setup

1. Download and install the latest Eclipse client

2. If you want to contribute to the project, you will need to make sure you are logged in to Gerrit and have setup your SSH keys. For more information on this, refer to: http://hyperledger-fabric.readthedocs.io/en/latest/Gerrit/lf-account.html

3. Clone the Java SDK from Gerrit. Make sure SSH and "Clone with commit-msg hook" are selected before you click on the copy to clipboard icon. Make sure the line you have copied has a: && scp .. errit.hyperledger.org:hooks/commit-msg fabric-sdk-java/.git/hooks/
* https://gerrit.hyperledger.org/r/#/admin/projects/fabric-sdk-java

4. Download and Install Maven, if you haven't already.
* https://maven.apache.org/download.cgi

5. Open up Eclipse to import the project. Go to File > Import > Maven > Existing Maven Project. Point to the location where you cloned the SDK in step 3.
* If you see the error: **Failed to read the project description file (.project) for 'fabric-sdk-java'. The file has been changed on disk, and it now contains invalid information. The project will not function properly until the description file is restored to a valid state.** Remove the comments on top of .project file and .classpath and try importing the project again.

6. Hit Finish.
* If you see error: **No marketplace entries found to handle maven-antrun-plugin:1.4:run in Eclipse. Please see Help for more information.** Continue to hit Finish. We will resolve this later.

7. Download dependencies. Navigate to you fabric-sdk-java folder, and execute the following command: **mvn install -DskipTests**

8. After running the command in step 6, you might see the following error in Eclipse: **Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.4:run (execution: default, phase: generate-test-resources).** Right click on the error and choose: **Mark goal run as ignored in eclipse.**

9. Enable Checkstyle. Go to Project > Properties > Checkstyle. Make sure the “Checkstyle active for this project”, “files outside source directories”, and “derived (generated) files” are all checked.

10. Hit “Local Check Configurations”, then select “New”. Choose “External Configuration File”, hit “Browse” and select “checkstyle-config.xml” from the fabric-sdk-java root directory.

11. Hit "Apply and Close", and the checkstyle will be applied.

Your eclipse environment should be set up now.
6 changes: 4 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
</reports>
</reportSet>
</reportSets>
<configuration>
<suppressionsLocation>suppressions.xml</suppressionsLocation>
<suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
</configuration>
</plugin>
<!-- https://mvnrepository.com/artifact/org.jacoco/jacoco-maven-plugin -->
<plugin>
Expand Down Expand Up @@ -461,7 +465,6 @@
<echo message="Creating diagnostic dump output directory"/>
<mkdir dir="./target/diagDump"/>
</tasks>

</configuration>
<goals>
<goal>run</goal>
Expand Down Expand Up @@ -500,7 +503,6 @@
</archive>
</configuration>
</plugin>

</plugins>
</build>
<distributionManagement>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/hyperledger/fabric/sdk/Channel.java
Original file line number Diff line number Diff line change
Expand Up @@ -3071,7 +3071,7 @@ class MatchPair {
}
}

List<MatchPair> matches = new LinkedList<>(); //Find matches.
List<MatchPair> matches = new LinkedList<MatchPair>(); //Find matches.

synchronized (chainCodeListeners) {

Expand Down
8 changes: 8 additions & 0 deletions suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">

<suppressions>
<suppress checks="." files="src/test/fixture/sdkintegration/javacc/example_cc/src/main/java/example/SimpleChaincode.java"/>
</suppressions>

0 comments on commit 213edec

Please sign in to comment.