我的项目中散布着各种位于包中的属性文件,当包目标从 Maven 构建运行时,这些属性文件不会被包含在内。
使用 0.10.2 m2eclipse 插件和默认的“package”目标。
在项目中:
src->main->java->mypackage->MyProperties.java
src->main->java->mypackage->MyProperties.properties
Run Code Online (Sandbox Code Playgroud)
运行“package”目标后,在展开的 war 目录中:
target->classes->mypackage->MyProperties.class
Run Code Online (Sandbox Code Playgroud)
-- 没有属性文件 --
我正在努力让团队采用 Maven,解决这个问题将成为一笔交易。移动属性文件是不切实际的。任何帮助深表感谢。
我重新启动了我的计算机,并使用 Ubuntu 12.04 重新启动了我的 VM,然后我重新启动了 Eclipse。然后我注意到有关于构建的错误,所以我在终端的 repo 上做了一个“mvn clean install”,之后我在 Eclipse 中重新导入了 Maven 项目(当该选项仍然可用时)。导入完成后,我注意到它说 mvn 缺少 m2e 中的“解包”命令。所以我想,我需要更新软件,所以我进入“帮助”>“检查更新”,然后我猜它找到了更好的 m2e 版本,但现在“导入现有的 Maven 项目”已经消失了。我尝试定期导入它,但是 'src/java/main' 和 'src/java/test' 没有区分为不同的特殊文件夹。
有没有其他人遇到过这个问题?如果是这样,你做了什么来解决这个问题。
提前致谢,
ejay
是否可以使用M2E从Eclipse运行mvn deploy?我在我的pom.xml中有distributionManagement部分,在我的settings.xml中配置了服务器,但我不能在我的生活中看到我可以触发该特定目标的位置.
我正在尝试通过在Maven Run Configurations 中使用以下命令使用 pom.xml 文件执行 testNG 主类。
exec:java -Dexec.mainClass=com.selenium.controls.TestNGMainClass
Run Code Online (Sandbox Code Playgroud)
在这里,我使用的是Java 8。
但我收到以下错误。
[INFO] ------------------------------------------------------------------------
[INFO] Building seleniumScriptsRegression 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:java (default-cli) @ seleniumScriptsRegression ---
[WARNING] java.lang.ClassNotFoundException: com.selenium.controls.TestNGMainClass
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:270)
at java.lang.Thread.run(Unknown Source)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.331 s
[INFO] Finished at: 2018-01-29T10:59:54+05:30
[INFO] Final Memory: 13M/32M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on …Run Code Online (Sandbox Code Playgroud) pom.xml当使用“Maven Pom Editor”在 Eclipse 中打开并切换到选项卡时pom.xml,我无法格式化该文件。
点击Ctrl+Shift+F完全未格式化的文件不会执行任何操作。通过上下文菜单时Source -> Format该Format选项被禁用。
当我以 a 格式打开文件时XML Editor,格式化工作正常。
知道为什么会出现这种情况吗?
我尝试了EMBEDDED Maven外部版本3.5.2
蚀:
Eclipse IDE for Java Developers
Version: Oxygen.2 Release (4.7.2)
Build id: 20171218-0600
m2e Plugin 1.8.2
Run Code Online (Sandbox Code Playgroud)
编辑[已解决]:
我在包资源管理器中右键单击该文件。在那里,源 -> 格式已启用。单击它会导致异常:
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 2
at org.eclipse.wst.sse.core.internal.text.TextRegionListImpl.get(TextRegionListImpl.java:147)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatWithinTag(DefaultXMLPartitionFormatter.java:886)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatStartTag(DefaultXMLPartitionFormatter.java:543)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatRegion(DefaultXMLPartitionFormatter.java:448)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatStartTag(DefaultXMLPartitionFormatter.java:564)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatRegion(DefaultXMLPartitionFormatter.java:448)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatStartTag(DefaultXMLPartitionFormatter.java:564)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatRegion(DefaultXMLPartitionFormatter.java:448)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatStartTag(DefaultXMLPartitionFormatter.java:564)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatRegion(DefaultXMLPartitionFormatter.java:448)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatStartTag(DefaultXMLPartitionFormatter.java:564)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatRegion(DefaultXMLPartitionFormatter.java:448) …Run Code Online (Sandbox Code Playgroud) 我对此感到非常沮丧,我已经从Spring安装了最新的STS版本,现在我正在尝试基于appfuse-basic-jsf设置一个简单的archtype项目.
通过选择New - > Maven Project - >从列表中选择appfuse-basic-jsf
它始终失败,并显示以下错误消息:
无法从原型创建项目[org.appfuse.archetype:appfuse-basic-jsf:RELEASE]
根据细节,它说:
定义的工件不是原型
任何帮助将不胜感激.
注意:我刚开始使用Jenkins插件开发,之前从未使用过maven.
我已经成功设置了一个带有maven和命令行的示例插件.(HelloWorldBuilder正在构建并正确运行mvn
hpi:run.)
然后我安装了eclipse(indigo)和m2e插件,并尝试将maven项目导入eclipse.(通过导入>现有Maven项目)
项目已导入,但它显示两个错误:
@ pom.xml,第1行:
<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/maven-v4_0_0.xsd">
Run Code Online (Sandbox Code Playgroud)
项目生成错误:Unresolveable新建扩建:插件org.jenkins- ci.tools:maven-hpi-plugin:1.72或它的一个依赖无法解析:无法找到神器的com.sun:工具:罐子:1.5在指定的路径C:\程序\的Java\JRE6 /../ lib中/的tools.jar
@ pom.xml,第12行:
<packaging>hpi</packaging>
Run Code Online (Sandbox Code Playgroud)
项目构建错误:未知包装:hpi
有任何想法吗?
我们正在使用Eclipse(3.7/Indigo),Tomcat(6/7)和m2e -wtp(0.13.1)开发JavaEE应用程序.该应用程序使用Maven overlay来重用其他应用程序提供的资源.
当前的情况非常烦人,每个代码更改都会触发重新发布,并且通常需要重新启动服务器.正如在这个答案中所建议的那样,我想启用没有发布复选框的Serve模块来使用热代码替换而不是发布.
但是,在此模式下运行时,覆盖的应用程序中的资源不可用.这似乎是由m2e-wtp中缺乏适当的覆盖支持引起的.还有一个问题,最近在M2E-WTP错误追踪系统提出的,但它不太可能被固定在不久的将来.
在没有发布模式的Serve模块中使用叠加层的最佳解决方法是什么?
我有像这样的pom.xml:
...
<properties>
<spring.version>3.0.5.RELEASE</spring.version>
</properties>
<dependencies>
<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
...
Run Code Online (Sandbox Code Playgroud)
当我spring.version换成3.2.2.RELEASE时,没有任何反应.我仍然在Libraries构建路径下有3.0.5.RELEASE.
我正在使用带有m2eclipse的Eclipse Indigo SR2.
编辑:请注意,我是maven世界的新手.
我有这种习惯,从不同的项目中查找其他源代码作为参考.但是,这会导致忘记关闭标签的累积问题.我可能有大约100个源标签打开(这与当前和不相关的项目有关).
是否有偏好或插件在某个空闲时段后自动关闭未使用的标签?就像10分钟不活动后说的那样.
我面临的问题是,当我匆忙时,标签堆积起来并消耗大量内存,更不用说你是否已经打开Chrome阅读文档和StackOverflow挖掘.最后由于交换使用而减慢了我的系统速度.
[更新] 从此链接中找到一些有趣的提示
那么如何在Eclipse中快速关闭不必要的标签?
m2eclipse ×10
eclipse ×7
maven ×7
java ×3
m2e ×3
maven-2 ×2
maven-plugin ×2
archetypes ×1
eclipse-cdt ×1
eclipse-rcp ×1
eclipse-wtp ×1
jenkins ×1
pom.xml ×1
tomcat ×1
war ×1