Setting up the Web3J Maven project

If you have already downloaded the code from GitHub, you can import it in Eclipse. Otherwise, if you want to build the project from scratch, you have to create a new Maven project, as follows:

  1. In the Eclipse IDE, navigate to File | New | Other to bring up the project-creation wizard.
  2. Scroll to the Maven folder, open it, and choose Maven Project. Then choose Next.
  3. Keep passing the dialogue forms by pressing next until you get the following form:

Here, you will need to enter information regarding the Maven project you are creating. Choose the names you want and press Finish. The following is what your sample project structure will look like at the end of the Maven project-creation process:

 

Then, in the Maven POM file (pom.xml), we'll need to add the following lines in the corresponding POM tags:

 <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>

After editing the Maven POM file, we have to update the project to download the necessary dependencies. Right-click on Project, click on Maven, then choose Update Project...:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset