gpt4 book ai didi

java - 使用 Maven 分发 akka 微内核应用程序

转载 作者:太空宇宙 更新时间:2023-11-04 07:58:20 25 4
gpt4 key购买 nike

我有一个用java开发的akka​​微内核应用程序。 为了分发应用程序,我使用了 JCrankyi 博客上的教程

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

使用 maven-assemble-plugin 和 akka 启动脚本。

descriptor.xml 如下所示

 <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 中的片段

 <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>

启动文件是一个批处理文件,内容如下。

@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 插件的错误如下所示。

[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 是一个文件夹,您必须指定该文件夹中的文件名。至少它不被识别为文件。

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

我认为您应该将启动脚本放入 src/main/scripts 中,如 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 目录即可。这是一个简单的例子:

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());
}
}

关于java - 使用 Maven 分发 akka 微内核应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13269293/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com