标签: m2eclipse

如何:Eclipse Maven安装带有依赖项的构建jar

我在Eclipse中使用Eclipse Maven(m2e),我正在运行我的项目:

pom.xml看起来像这样:

<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">
    <modelVersion>4.0.0</modelVersion>
    <groupId>ro.project</groupId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>ro.project</name>

    <properties>
        <org.springframework.version>3.1.1.RELEASE</org.springframework.version>
        <org.hibernate.version>4.1.0.Final</org.hibernate.version>
    </properties>
    <dependencies>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>ro.project.ProjectServer</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>com.sun</groupId>
                        <artifactId>tools</artifactId>
                        <version>1.7.0_02</version>
                        <scope>system</scope>
                        <systemPath>${java.home}/../lib/tools.jar</systemPath>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>ant-magic</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <property name="compile_classpath" refid="maven.compile.classpath" />
                                <property name="runtime_classpath" refid="maven.runtime.classpath" />
                                <property name="test_classpath" refid="maven.test.classpath" />
                                <property name="plugin_classpath" refid="maven.plugin.classpath" />

                                <ant antfile="${basedir}/clientExport.xml" target="export-all" /> …
Run Code Online (Sandbox Code Playgroud)

java dependencies m2eclipse maven-3 maven

19
推荐指数
1
解决办法
8万
查看次数

Jacoco Maven插件 - 生命周期配置不包含插件执行

我是Maven的新手,想要使用Jacoco Maven插件来构建我的项目.

我已经建立了一个示例项目,其中TestNG是唯一的依赖项.

这是pom.xml的一部分:

<dependencies>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.6.2.201302030002</version>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>report</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

我得到这个错误:

生命周期配置未涵盖的插件执行:org.jacoco:jacoco-maven- plugin:0.6.2.201302030002:prepare-agent(执行:默认,阶段:初始化)

我究竟做错了什么 ?干杯

m2eclipse maven m2e jacoco

19
推荐指数
3
解决办法
3万
查看次数

如何在Eclipse Helios中安装Maven集成插件?

我正在尝试通过Marketplace在Eclipse Helios中安装Maven集成插件,但我收到"无法满足依赖"错误:

Cannot complete the install because one or more required items could not be found.
  Software being installed: m2e - Maven Integration for Eclipse 1.4.0.20130601-0317 (org.eclipse.m2e.feature.feature.group 1.4.0.20130601-0317)
  Missing requirement: async-http-client 1.6.5.20130531-2315 (com.ning.async-http-client 1.6.5.20130531-2315) requires 'package org.slf4j 1.6.2' but it could not be found
  Cannot satisfy dependency:
    From: Maven Archetype Common Bundle 1.4.0.20130531-2315 (org.eclipse.m2e.archetype.common 1.4.0.20130531-2315)
    To: bundle org.eclipse.m2e.maven.runtime [1.4.0,1.5.0)
  Cannot satisfy dependency:
    From: m2e - Maven Integration for Eclipse 1.4.0.20130601-0317 (org.eclipse.m2e.feature.feature.group 1.4.0.20130601-0317)
    To: org.eclipse.m2e.archetype.common [1.4.0.20130531-2315]
  Cannot satisfy dependency:
    From: Embedded …
Run Code Online (Sandbox Code Playgroud)

eclipse m2eclipse maven m2e

19
推荐指数
2
解决办法
4万
查看次数

Eclipse无法识别src/main/webapp目录

我使用m2eclipse在Eclipse中导入Maven Java项目.

它无法识别src/main/webapp为源目录.

在包浏览器中以图形方式(或者当我在项目的属性中查看Java-Build-Path时),
此目录不在sources文件夹列表中(while src/main/javasrc/main/resourcesdo).

要访问它,我必须直接查看src /目录,并开始展开...不是很方便!

但是,如果我运行maven install,资源将被复制到正确的目录.
(例如: src/main/webapp/index.jsptarget/mywar/index.jsp)

问题

  1. 这是正确的行为吗?(我以为它可以被视为其他资源...)
  2. 我可以修理吗?
  3. 我想知道这种情况是否有其他缺点,我现在不会意识到这一点?

java maven-2 directory-structure m2eclipse

18
推荐指数
3
解决办法
2万
查看次数

Eclipse中的Maven/AJDT项目

我需要在maven项目中使用aspectj.我为eclipse(m2e)安装了maven插件,maven aspectj插件以及Eclipse的AJDT.所以现在,当我打开一个新项目时,我有"Maven项目"和"AspectJ项目".我怎样才能创建一个Maven AspectJ项目的新项目?我没有找到任何参考,所以你是我唯一的希望.谢谢

eclipse aspectj m2eclipse ajdt maven

18
推荐指数
2
解决办法
1万
查看次数

为什么Maven会更改Eclipse项目首选项?

首先,我正在使用Ubuntu 12.04,Eclipse Juno和embebbed maven 3.0.4(m2eclipse),我必须在一个遗留项目中工作,这是我从SVN repositroy获得的.

我遇到了Maven和Eclipse的一种配置问题.

我第一次做Maven> Update项目时遇到了"Maven Java EE配置问题"类型的"未知错误".我检查了我的项目的属性,我意识到java合规性级别设置为1.5,但我已激活1.6 JRE.好吧,我已经改为1.6版本(在Java Facet中),但是当我执行Maven> Update项目时,我的项目属性将恢复为默认值(也就是1.5版本),并且未知错误仍然存​​在.

我的pom.xml文件似乎没问题,我也尝试使用空的pom.xml更新项目(仅使用modelVersion,groupId,artifactId,version,name和url标签)并且我总是得到相同的错误.

我真的被卡住了.有人有线索吗?

eclipse configuration m2eclipse maven

18
推荐指数
1
解决办法
1万
查看次数

Eclipse JVM配置

背景:我有一个新的eclipse安装并安装了m2eclipse插件.启动后m2eclipse生成消息:

Eclipse在JRE中运行,但是需要JDK

按照这里的说明,我已经将eclipse.ini文件更改为使用JDK JVM:

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-vm
"C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe"
Run Code Online (Sandbox Code Playgroud)

然而,在重新启动eclipse之后,我仍然收到消息说它在JRE而不是JDK下运行.

通过帮助 - >关于Eclipse - >安装细节 - >配置查看 eclipse 配置,似乎eclipse正在从其他地方获取JVM配置详细信息:

...
-vm
C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
eclipse.home.location=file:/C:/Program Files (x86)/eclipse/
eclipse.launcher=C:\Program Files (x86)\eclipse\eclipse.exe
eclipse.p2.data.area=@config.dir/../p2/
eclipse.p2.profile=epp.package.jee
eclipse.product=org.eclipse.epp.package.jee.product
eclipse.startTime=1252669330296
eclipse.vm=C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
eclipse.vmargs=-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-vm
"C:\Program Files\Java\jdk1.6.0_16\bin\javaw.exe"
-XX:MaxPermSize=256m
...
Run Code Online (Sandbox Code Playgroud)

我的问题是第一个-vm参数来自何处以及如何删除或更改它?

谢谢

更新:我根据VonC的回答更新了eclipse.ini文件.我现在在启动eclipse时遇到错误说:

必须提供Java运行时环境(JRE)或Java Development Kit(JDK)才能运行Eclipse.搜索以下位置后未找到Java虚拟机:"C:\ Program Files\Java\jdk1.6.0_16\bin\javaw.exe"

我已经确认路径是正确的,可以通过命令行执行.

完成下面的eclipse.ini:

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519 …
Run Code Online (Sandbox Code Playgroud)

eclipse configuration jvm m2eclipse

17
推荐指数
2
解决办法
7万
查看次数

缺少本地存储库中的tools.jar会破坏m2eclipse

我遇到的问题是eclipse无法解决我的项目的任何依赖项.这会导致问题,因为即使依赖关系似乎在编码时工作正常(我得到自动完成),我仍然会得到一个很大的错误列表,指出缺少的工件.

过滤这些时,我发现了以下内容:

容器'Maven Dependencies'引用了不存在的库'/home/[...]/.m2/repository/com/sun/tools/1.5.0/tools-1.5.0.jar'

看起来这个依赖是由struts2引入的,他们的pom中的配置文件如下所示:

<dependency>
    <groupId>com.sun</groupId>
    <artifactId>tools</artifactId>
    <version>1.5.0</version>
    <scope>system</scope>
    <systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
Run Code Online (Sandbox Code Playgroud)

那个systemPath解析了,所以我没有看到这会导致麻烦的原因.在任何情况下,有没有办法告诉eclipse这个m2eclipse依赖是一个在本地存储库中找不到的系统依赖?

java eclipse m2eclipse maven

17
推荐指数
5
解决办法
4万
查看次数

Java文件中的Maven版本号

我来自ANT,您可以通过执行某种方法调用.java文件来获取版本号.我想在我的新pom.xml中做类似的事情来自动获取正确的版本号.我需要应用程序了解它自己的版本,同时Maven知道版本得到了正确的版本.持有版本infomormation加倍是没有选择.

或者Maven可以在构建期间/之前创建一个新的.java文件吗?

我可以想象很多方法来实现这个目标,但是在Maven项目中有没有最佳实践方法呢?

java ant build m2eclipse maven

17
推荐指数
1
解决办法
1万
查看次数

如何强制Sonatype Nexus更新?

我想在我的pom.xml中使用onejar-maven-plugin:

<plugin>
    <groupId>org.dstovall</groupId>
    <artifactId>onejar-maven-plugin</artifactId>
    <version>1.4.4</version>
    <executions>
        <execution>
            <configuration>
                <mainClass>com.exmaple.myproj.MpPort_MpSoapPort_Client</mainClass>
                <onejarVersion>0.97</onejarVersion>
                <attachToBuild>true</attachToBuild>
                <classifier>onejar</classifier>
            </configuration>
            <goals>
                <goal>one-jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

<pluginRepositories>
    <pluginRepository>
        <id>onejar-maven-plugin.googlecode.com</id>
        <url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url>
    </pluginRepository>
</pluginRepositories>
Run Code Online (Sandbox Code Playgroud)

但由于某种原因,尝试通过Eclipse Maven插件(Maven安装)构建它会导致BUILD ERROR:

Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository onejar-maven-plugin.googlecode.com (http://onejar-maven-plugin.googlecode.com/svn/mavenrepo)
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository central (http://repo1.maven.org/maven2)
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's …
Run Code Online (Sandbox Code Playgroud)

maven-2 nexus m2eclipse sonatype maven

17
推荐指数
1
解决办法
3万
查看次数