如何使用Maven进行不同的Java课程?

发布于 2025-02-03 14:56:29 字数 1263 浏览 3 评论 0 原文

几乎是标题问题。我还发现了其他几个问题,但是它们有点老了,我不知道是否有一个值得一提的新解决方案。

因此,我正在使用 tutorials 用于java akka库。我已经复制了该项目,并用Emacs打开了该项目。目前,在 pom.xml 中指定了要运行的主类:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.6.0</version>
  <configuration>
    <executable>java</executable>
    <arguments>
      <argument>-classpath</argument>
      <classpath />
      <argument>com.example.AkkaQuickstart</argument> <!-- HERE -->
    </arguments>
  </configuration>
</plugin>

但是如果我想拥有两个或多个主要类,并像Intellij ?现在,这不是一个糟糕的问题,而是一个小问题,但欢迎提出建议。

  • 我应该从命令行指定主类吗?使用 exec:java exec:exec pom.xml 的哪些部分我应该发表评论?
  • 我应该使用
  • 顺便说一句,由于我想要类似于Intellij的东西,您知道Intellij实际上是如何做到的吗?

感谢您的时间和帮助!

Pretty much the title question. I have found several other questions on SO, but they're a bit old and I don't know if there's a new solution worth mentioning.

So I am working with the tutorials for the Java Akka library. I have copied the project and opened it with Emacs. Right now, the main class to be run is specified in the pom.xml:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.6.0</version>
  <configuration>
    <executable>java</executable>
    <arguments>
      <argument>-classpath</argument>
      <classpath />
      <argument>com.example.AkkaQuickstart</argument> <!-- HERE -->
    </arguments>
  </configuration>
</plugin>

But what if I wanted to have two or more main classes, and run them separately as in IntelliJ? Now, this is not as much an Emacs question as a Maven one, but suggestions are welcome.

  • Should I specify the main class from command line? Using exec:java or exec:exec? What parts of pom.xml should I comment out?
  • Should I use a workaround like in this question?
  • By the way, since I want something similar to IntelliJ, do you know how IntelliJ actually does this?

Thanks for your time and help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文