Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ZEPPELIN-1928]: Get a rid of preinstalled external dependencies (nodejs and npm) for maven build #2002

Closed
wants to merge 10 commits into from
22 changes: 21 additions & 1 deletion docs/install/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,31 @@ If you don't have requirements prepared, install it.
sudo apt-get update
sudo apt-get install git
sudo apt-get install openjdk-7-jdk
sudo apt-get install npm
```

For testing of zeppelin-web with phantomjs in Linux, please install required dependency

For Ubuntu

```
sudo apt-get install libfontconfig
```

For Centos/RHEL

```
sudo yum install fontconfig
```

Otherwise use
```
-DskipTests
```
or
```
-Dmaven.test.skip=true
```
maven option.

### Install maven
```
Expand Down
48 changes: 47 additions & 1 deletion zeppelin-web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,72 @@ This will download all the dependencies including node (the binaries in the fold
```
$ mvn package
```
#### You also can use maven for build and test

If you want just build web application use:
```
$ mvn compile
```

If you want just test web application use:
```
$ mvn test
```

Please note! Run

```
$ mvn clean
```

will clean local nodejs installation and all installed packages
So, if you want to save time for rebuild use maven option:

```
-Dmaven.clean.skip=true
```

If you want skip tests of web application maven option:
```
-Dmaven.test.skip=true
```
or
```
-DskipTests
```

### Local Development

It is recommended to install node 6.0.0+ since Zeppelin uses 6.9.1+ (see [creationix/nvm](https://github.com/creationix/nvm))

All build commands are described in [package.json](./package.json)

```sh
# install required depepdencies and bower packages (only once)
```
$ npm install -g yarn
```

```
$ yarn install
```

```
$ bower install --silent
```

# build zeppelin-web for production
```
$ yarn run build
```

# run frontend application only in dev mode (localhost:9000)
# you need to run zeppelin backend instance also
```
$ yarn run dev
```

# execute tests
```
$ yarn run test
```

Expand Down
3 changes: 1 addition & 2 deletions zeppelin-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
},
"scripts": {
"clean": "rimraf dist && rimraf .tmp",
"postinstall": "bower install --silent",
"prebuild": "npm-run-all clean",
"build": "grunt pre-webpack-dist && webpack && grunt post-webpack-dist",
"predev": "grunt pre-webpack-dev",
Expand All @@ -16,7 +15,7 @@
"dev:watch": "grunt watch-webpack-dev",
"dev": "npm-run-all --parallel dev:server dev:watch",
"visdev": "npm-run-all --parallel visdev:server dev:watch",
"pretest": "npm install karma-phantomjs-launcher",
"pretest": "npm install karma-phantomjs-launcher --no-lockfile --no-bin-links",
"test": "karma start test/karma.conf.js"
},
"dependencies": {
Expand Down
169 changes: 141 additions & 28 deletions zeppelin-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,63 @@
<!--plugin versions-->
<plugin.frontned.version>1.3</plugin.frontned.version>
</properties>

<profiles>
<profile>
<id>install-yarn-bover-etc-before-compile</id>
<activation>
<file>
<missing>${basedir}/node/node</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${plugin.frontned.version}</version>
<executions>

<execution>
<id>install node and yarn</id>
<goals>
<goal>install-node-and-yarn</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<nodeVersion>${node.version}</nodeVersion>
<yarnVersion>${yarn.version}</yarnVersion>
</configuration>
</execution>

<execution>
<id>yarn add bower</id>
<goals>
<goal>yarn</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<arguments>add bower karma-phantomjs-launcher --no-lockfile --no-bin-links</arguments>
</configuration>
</execution>

<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<arguments>install --silent --allow-root</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -107,47 +163,84 @@
<artifactId>frontend-maven-plugin</artifactId>
<version>${plugin.frontned.version}</version>
<executions>

<execution>
<id>install node and yarn</id>
<goals>
<goal>install-node-and-yarn</goal>
</goals>
<phase>post-clean</phase>
<configuration>
<nodeVersion>${node.version}</nodeVersion>
<yarnVersion>${yarn.version}</yarnVersion>
</configuration>
</execution>

<execution>
<id>yarn install</id>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>install --no-lockfile</arguments>
</configuration>
<id>yarn add bower</id>
<goals>
<goal>yarn</goal>
</goals>
<phase>post-clean</phase>
<configuration>
<arguments>add bower karma-phantomjs-launcher --no-lockfile --no-bin-links</arguments>
</configuration>
</execution>

<execution>
<id>yarn build</id>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<phase>post-clean</phase>
<configuration>
<arguments>install --silent --allow-root</arguments>
</configuration>
</execution>

<execution>
<id>pre-webpack-dist</id>
<goals>
<goal>grunt</goal>
</goals>
<phase>compile</phase>
<configuration>
<arguments>pre-webpack-dist</arguments>
</configuration>
</execution>

<execution>
<id>yarn test</id>
<goals>
<goal>yarn</goal>
</goals>
<phase>test</phase>
<configuration>
<arguments>run test</arguments>
</configuration>
<id>webpack build</id>
<goals>
<goal>webpack</goal>
</goals>
<phase>compile</phase>
<configuration>
<arguments>-p</arguments>
</configuration>
</execution>

<execution>
<id>post-webpack-dist</id>
<goals>
<goal>grunt</goal>
</goals>
<phase>compile</phase>
<configuration>
<arguments>post-webpack-dist</arguments>
</configuration>
</execution>

<execution>
<id>javascript tests</id>
<goals>
<goal>karma</goal>
</goals>

<phase>test</phase>
<configuration>
<karmaConfPath>test/karma.conf.js</karmaConfPath>
</configuration>
</execution>

</executions>
Expand Down Expand Up @@ -183,18 +276,38 @@
<filesets>
<fileset>
<directory>bower_components</directory>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<fileset>
<directory>node</directory>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<fileset>
<directory>node_modules</directory>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>target</directory>
</fileset>
<fileset>
<directory>dist</directory>
</fileset>
<fileset>
<directory>.tmp</directory>
</fileset>
<fileset>
<directory>.</directory>
<includes>
<include>*.log</include>
<include>yarn.lock</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugin>
</plugins>
</build>



</project>
2 changes: 1 addition & 1 deletion zeppelin-web/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module.exports = function makeWebpackConfig () {

// Output path from the view of the page
// Uses webpack-dev-server in development
publicPath: isProd ? '' : 'http://localhost:9000/',
publicPath: isProd ? '' : './',

// Filename for entry points
// Only adds hash in build mode
Expand Down