使用Maven分发Akka微内核应用程序 [英] distributing the akka micro kernel application with maven

查看:76
本文介绍了使用Maven分发Akka微内核应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用Java开发的akka​​微内核应用程序. 为了分发该应用程序,我使用了JCrankyi博客

I have an akka micro kernel application developed in java. To distributed the application , I used the tutorials at the JCrankyi's blog

 http://jcranky.com/2012/07/13/akka-microkernel-with-maven/#comment-1322

使用maven-assembly-plugin和akka启动脚本.

using the maven-assembly-plugin and the the akka start script.

descriptor.xml如下所示

the descriptor.xml is presented below

 <id>akka</id>

  <formats>
    <format>zip</format>
  </formats>

  <fileSets>
    <fileSet>
      <directory>${Com-RubineEngine-GesturePoints}</directory>
      <outputDirectory>/deploy</outputDirectory>
      <includes>
        <include>*.jar</include>
      </includes>
    </fileSet>
  </fileSets>

  <dependencySets>
    <dependencySet>
      <outputDirectory>/lib</outputDirectory>
    </dependencySet>
  </dependencySets>

  <files>
    <file>
      <source>src/main/start</source>
      <outputDirectory>/bin</outputDirectory>
    </file>

    <file>
      <source>src/main/resources/application.conf</source>
      <outputDirectory>/config</outputDirectory>
    </file>
  </files>

</assembly>

POM.xml中的片段

The snippets from the POM.xml

 <plugin>
  <artifactId>maven-assembly-plugin</artifactId>
  <version>2.3</version>
  <configuration>
    <descriptors>
      <descriptor>/descriptor.xml</descriptor>
    </descriptors>
  </configuration>

  <executions>
    <execution>
      <id>make-assembly</id>
      <phase>package</phase>
      <goals>
        <goal>single</goal>
      </goals>
    </execution>
  </executions>
</plugin>   

起始文件是批处理文件,其内容如下所示.

the start file is a batch file and the content is presented below.

@echo off
set SAMPLE=%~dp0..
set AKKA_HOME=%SAMPLE%\..\..\..\..
set JAVA_OPTS=-Xms1024M -Xmx1024M -Xss1M -XX:MaxPermSize=256M -XX:+UseParallelGC
set AKKA_CLASSPATH=%AKKA_HOME%\lib\scala-library.jar;%AKKA_HOME%\lib\akka\*
set SAMPLE_CLASSPATH=%SAMPLE%\config;%AKKA_CLASSPATH%;%SAMPLE%\lib\*

java %JAVA_OPTS% -cp "%SAMPLE_CLASSPATH%" -Dakka.home="%SAMPLE%" akka.kernel.Main

以下是来自Maven Assembly:assembly插件的错误.

the error from the maven assembly:assembly plugin is presented below.

[INFO] Reading assembly descriptor: /descriptor.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.124s
[INFO] Finished at: Wed Nov 07 11:46:10 GMT 2012
[INFO] Final Memory: 11M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.
3:single (make-assembly) on project com-theta-gesture: Failed to create assembly
: Error adding file to archive: C:\Users\FAISAL\Desktop\disaster\com-theta-gestu
re\src\main\start isn't a file. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception

推荐答案

我认为错误非常明显.

C:\Users\FAISAL\Desktop\disaster\com-theta-gesture\src\main\start isn't a file

我假设src/main/start是一个文件夹,您将必须在该文件夹中指定文件名.至少它不被识别为文件.

I assume that src/main/start is a folder and you will have to specify the name of a file in that folder. At least it is not recognized as a file.

<files>
    <file>
        <source>src/main/start</source>
        <outputDirectory>/bin</outputDirectory>
    </file>
</files>

我认为您应该按照src/main/scripts中. html"rel =" nofollow>标准目录布局简介.

I think you should put the start script in src/main/scripts as described in the Introduction to the Standard Directory Layout.

<files>
    <file>
        <source>src/main/scripts/start.bat</source>
        <outputDirectory>/bin</outputDirectory>
    </file>
</files>


修改

为了验证您的start文件确实是文件,只需将简单的JUnit测试添加到您的src/main/test目录.这是一个简单的示例:

In order to verify that your start file is really a file then just add a simple JUnit test to your src/main/test directory. Here is a simple example:

package com.stackoverflow;

import org.junit.Test;

import java.io.File;

import static org.junit.Assert.assertTrue;

/**
 * @author maba, 2012-11-08
 */
public class FileTest {
    @Test
    public void testIfStartScriptIsFile() {
        File file = new File("src/main/scripts/start.bat");
        assertTrue("The tested file is not a real file!!!", file.isFile());
    }
}

这篇关于使用Maven分发Akka微内核应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆