You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/11/08 20:16:34 UTC

[GitHub] nswamy closed pull request #12827: Update scala intellij tutorial

nswamy closed pull request #12827: Update scala intellij tutorial
URL: https://github.com/apache/incubator-mxnet/pull/12827
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/docs/tutorials/scala/mxnet_scala_on_intellij.md b/docs/tutorials/scala/mxnet_scala_on_intellij.md
index 497b1cd012e..e28359b2696 100644
--- a/docs/tutorials/scala/mxnet_scala_on_intellij.md
+++ b/docs/tutorials/scala/mxnet_scala_on_intellij.md
@@ -73,7 +73,6 @@ The configuration you should update is in the pom file's dependency for MXNet:
 <dependency>
   <groupId>org.apache.mxnet</groupId>
   <artifactId>mxnet-full_2.11-osx-x86_64-cpu</artifactId>
-  <version>1.2.0</version>
 </dependency>
 ```
 
@@ -158,7 +157,7 @@ The project's `pom.xml` will be open for editing.
 
 **Step 3.** Replace the pom file's content with the following code. Changes include:
   - Project properties: `scala.version`, upgrading from `2.11.5` to `2.11.8`
-  - Project dependencies: adding the MXNet package from Maven and updating the dependency for JUnitRunner (specs2-junit_)
+  - Project dependencies: adding the MXNet package from Maven and updating the dependency for JUnitRunner (specs2-junit_) and logging
   - Build options: removing '-make:transitive'
 
 
@@ -204,19 +203,25 @@ The project's `pom.xml` will be open for editing.
     <encoding>UTF-8</encoding>
     <scala.version>2.11.8</scala.version>
     <scala.compat.version>2.11</scala.compat.version>
+    <slf4jVersion>1.7.7</slf4jVersion>
+    <platform>osx-x86_64-cpu</platform>
   </properties>
 
   <dependencies>
     <dependency>
       <groupId>org.apache.mxnet</groupId>
       <artifactId>mxnet-full_2.11-osx-x86_64-cpu</artifactId>
-      <version>1.2.0</version>
     </dependency>
     <dependency>
       <groupId>org.scala-lang</groupId>
       <artifactId>scala-library</artifactId>
       <version>${scala.version}</version>
     </dependency>
+    <dependency>
+      <groupId>args4j</groupId>
+      <artifactId>args4j</artifactId>
+      <version>2.0.29</version>
+    </dependency>
 
     <!-- Test -->
     <dependency>
@@ -237,6 +242,18 @@ The project's `pom.xml` will be open for editing.
       <version>2.2.4</version>
       <scope>test</scope>
     </dependency>
+
+    <!-- Logging -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>${slf4jVersion}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>${slf4jVersion}</version>
+    </dependency>
   </dependencies>
 
   <build>
@@ -292,11 +309,24 @@ The project's `pom.xml` will be open for editing.
 
 Click "Import Changes" in this prompt.
 
-**Step 5.** Build the project:
+**Step 5.** Setup log4j configuration
+
+Create a folder `src/main/resources` and a new file in it `src/main/resources/log4j.properties` with the contents:
+
+```
+log4j.rootLogger = info, stdout
+
+log4j.appender.stdout = org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target = System.out
+log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] [%c] [%p] - %m%n
+```
+
+**Step 6.** Build the project:
 - To build the project, from the menu choose Build, and then choose Build Project.
 
 
-**Step 6.** Run the Hello World App:
+**Step 7.** Run the Hello World App:
 
 ![hello world app](https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/scala/intellij-project-hello-world-app.png)
 
@@ -306,7 +336,7 @@ Navigate to the App included with the project.
 
 Run the App by clicking the green arrow, and verify the Hello World output
 
-**Step 7.** Run Sample MXNet Code in the App:
+**Step 8.** Run Sample MXNet Code in the App:
 
 ![run hello mxnet](https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/scala/intellij-project-hello-mxnet.png)
 
@@ -347,6 +377,28 @@ Library not loaded: /usr/local/opt/opencv/lib/libopencv_calib3d.x.x.dylib
 This can be resolved be installing OpenCV.
 
 
+### Using MXNet from source
+
+If you chose to "Build from Source" when following the [install instructions](https://mxnet.incubator.apache.org/install/index.html) (or the detailed [build from source instructions](https://mxnet.incubator.apache.org/install/build_from_source.html#installing-mxnet-language-bindings)), you can use your custom build instead of the build from maven.  Use your build by editing the `pom.xml` file and replacing the `org.apache.mxnet` dependency with the following:
+
+```
+      <groupId>org.apache.mxnet</groupId>
+      <artifactId>mxnet-core_${scala.version}-${platform}-sources</artifactId>
+      <scope>system</scope>
+      <systemPath>/PathToMXNetSource/incubator-mxnet/scala-package/assembly/osx-x86_64-cpu/target/mxnet-full_${scala.version}-osx-x86_64-cpu-1.3.1-SNAPSHOT-sources.jar</systemPath>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.mxnet</groupId>
+      <artifactId>mxnet-full_${scala.version}-${platform}</artifactId>
+      <scope>system</scope>
+      <systemPath>/PathToMXNetSource/incubator-mxnet/scala-package/assembly/osx-x86_64-cpu/target/mxnet-full_${scala.version}-osx-x86_64-cpu-1.3.1-SNAPSHOT.jar</systemPath>
+    </dependency>
+```
+
+Note that you have to edit both of the `systemPath` properties to point to your generated jar files.
+
+
 ### Command Line Build Option
 
 - You can also compile the project by using the following command at the command line. Change directories to this project's folder then run the following:


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services