在没有主类的情况下运行玉器程序(Running a jade program without a main class)
我有一个简单的maven项目,下面的代码。
import jade.core.Agent; public class HelloAgent extends Agent { protected void setup() { System.out.println(getLocalName()); } }我该如何运行这个程序? 当我右键单击运行它时,我没有看到作为Java应用程序运行。 我在这里按照教程
http://www.iro.umontreal.ca/~vaucher/Agents/Jade/primer2.html % javac HelloAgent.java % java jade.Boot fred:HelloAgent产量
fredI have a simple maven project with the Code below.
import jade.core.Agent; public class HelloAgent extends Agent { protected void setup() { System.out.println(getLocalName()); } }How do I run this program?. When i right click to run it, I dont see a run as Java Application. I am following the tutorial here
http://www.iro.umontreal.ca/~vaucher/Agents/Jade/primer2.html % javac HelloAgent.java % java jade.Boot fred:HelloAgentOutput
fred最满意答案
您需要将maven设置为执行执行jade.Boot的运行任务。 您有几种不同的方法可以做到这一点 。 这是Jade使用'profiles'的完整示例。
对于上面的示例,它看起来有点像:
<profile> <id>jade-fred</id> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.3.2</version> <configuration> <mainClass>jade.Boot</mainClass> <arguments> <argument>fred:HelloAgent</argument> </arguments> </configuration> </plugin> </plugins> </build> </profile>并将执行:
mvn -Pjade-fred exec:javaYou need to set maven up to have a run task that executes jade.Boot. You have a few different ways to do this. Here is a complete example for Jade using 'profiles'.
For your example above, it would look somewhat like:
<profile> <id>jade-fred</id> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.3.2</version> <configuration> <mainClass>jade.Boot</mainClass> <arguments> <argument>fred:HelloAgent</argument> </arguments> </configuration> </plugin> </plugins> </build> </profile>and would be executed with:
mvn -Pjade-fred exec:java更多推荐
发布评论