不能运行 java kurento 6.4.0教程

Can't run java tutorial of kurento 6.4.0

我在虚拟机上安装了 kurento-media-server 版本 6.4.0,并执行了 javascript 教程,这些都有效。但是我无法在主机系统上执行 java 教程。

我的机器上有 oracle jdk 版本 1.8.0_91 和 maven 版本 3.3.9。我已经为 java 脚本教程安装了 Bower。

当我用命令编译hello-world教程时:

git checkout 6.4.0
mvn compile exec:java

提示显示错误:

[INFO] Scanning for projects...
[INFO]                                       
[INFO] ------------------------------------------------------------------------
[INFO] Building Kurento Java Tutorial - Hello World 6.4.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-java-version) @ kurento-hello-world ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven-version) @ kurento-hello-world ---
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.4:create-timestamp (get-build-timestamp) @ kurento-hello-world ---
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.4:create (get-scm-revision) @ kurento-hello-world ---
[INFO] Executing: /bin/sh -c cd '/home/kurento-tutorial-java/kurento-hello-world' && 'git' 'rev-parse' '--verify' 'HEAD'
[INFO] Working directory: /home/kurento-tutorial-java/kurento-hello-world
[INFO] Storing buildNumber: 9fba36e32343bb490384a4e1869e2b40de78fa2e at timestamp: 1463241859150
[WARNING] Cannot get the branch information from the git repository: 
Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref

[INFO] Executing: /bin/sh -c cd '/home/kurento-tutorial-java/kurento-hello-world' && 'git' 'rev-parse' '--verify' 'HEAD'
[INFO] Working directory: /home/kurento-tutorial-java/kurento-hello-world
[INFO] Storing buildScmBranch: UNKNOWN
[INFO] 
[INFO] --- exec-maven-plugin:1.4.0:exec (default) @ kurento-hello-world ---
bower                         EINVALID Failed to read /home/kurento-tutorial-java/kurento-hello-world/bower.json

Additional error details:
Name must be lowercase, can contain digits, dots, dashes, "@" or spaces
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.634 s
[INFO] Finished at: 2016-05-14T18:04:20+02:00
[INFO] Final Memory: 21M/219M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:exec (default) on project kurento-hello-world: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我在hello-world文件夹里有文件bower.json,内容是这样的:

{
  "name": "${project.artifactId}",
  "version": "${project.version}",
  "description": "${project.description}",
  "authors": [
    "Kurento <info@kurento.org>"
  ],
  "main": "index.html",
  "moduleType": [
    "globals"
  ],
  "license": "LGPL",
  "homepage": "http://www.kurento.org/",
  "private": true,
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "bootstrap": "~3.3.0",
    "ekko-lightbox": "~3.1.4",
    "adapter.js": "*",
    "demo-console": "1.5.1"
  }
}

pom.xml 文件:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.kurento.tutorial</groupId>
        <artifactId>kurento-tutorial</artifactId>
        <version>6.4.0</version>
    </parent>

    <artifactId>kurento-hello-world</artifactId>
    <packaging>jar</packaging>

    <name>Kurento Java Tutorial - Hello World</name>
    <description>Hello World (WebRTC in loopback)</description>

    <licenses>
        <license>
            <name>GNU Lesser General Public License</name>
            <url>http://www.gnu.org/licenses/lgpl-2.1.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <organization>
        <name>Kurento</name>
        <url>http://www.kurento.org</url>
    </organization>

    <scm>
        <url>https://github.com/Kurento/kurento-tutorial-java</url>
        <connection>scm:git:https://github.com/Kurento/kurento-tutorial-java</connection>
        <developerConnection>scm:git://git@github.com:Kurento/kurento-tutorial-java</developerConnection>
        <tag>develop</tag>
    </scm>

    <developers>
        <developer>
            <id>kurento.org</id>
            <name>-kurento.org Community</name>
            <organization>Kurento.org</organization>
            <organizationUrl>http://www.kurento.org</organizationUrl>
        </developer>
    </developers>

    <properties>
        <demo.port>8081</demo.port>

        <!-- Main class -->
        <start-class>org.kurento.tutorial.helloworld.HelloWorldApp</start-class>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-websocket</artifactId>
        </dependency>

        <!-- Kurento -->
        <dependency>
            <groupId>org.kurento</groupId>
            <artifactId>kurento-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.kurento</groupId>
            <artifactId>kurento-utils-js</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>${start-class}</mainClass>
                    <layout>ZIP</layout>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <executable>bower</executable>
                    <arguments>
                        <argument>install</argument>
                        <argument>--allow-root</argument>
                    </arguments>
                    <mainClass>${start-class}</mainClass>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/resources/static/bower_components</directory>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
        </plugins>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>banner.txt</include>
                </includes>
            </resource>
            <resource>
                <directory>.</directory>
                <filtering>true</filtering>
                <includes>
                    <include>bower.json</include>
                </includes>
            </resource>
        </resources>
    </build>

    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptor>src/assembly/bin.xml</descriptor>
                            <finalName>${project.artifactId}-${project.version}</finalName>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <configuration>
                                    <tasks>
                                        <copy
                                            file="${project.build.directory}/target/${project.artifactId}-${project.version}-bin.zip"
                                            tofile="${project.build.directory}/target/${project.artifactId}-${project.version}.zip" />
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>no-assembly</id>
        </profile>
    </profiles>
</project>

好的解决了,我用 bower.json 文件中的值替换了变量,现在它构建了。

为了正确执行,我还修改了 adapter.js 与 "v0.2.9"

的依赖项的值