我可以从maven Projects窗格(在IDE屏幕的左侧)执行maven目标。例如,我可以使用compile目标很好地编译项目。
现在,我想使用BuildMake项目选项从UI构建项目。然而,它不起作用。它抱怨丢失的应用程序包,就好像它没有看到依赖关系一样。这些依赖关系在各自的pom.xml文件中定义,但是从IDE中创建项目似乎忽略了它。
我要做什么才能让它起作用?
"C:\Program Files (x86)\Java\jdk1.6.0_29\bin\java" -Dclassworlds.conf=O:\java\apache-maven-3.0.4\bin\m2.conf -Dmaven.home=O:\java\apache-maven-3.0.4 -Didea.launcher.port=7534 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 11.1.2\bin" -Dfile.encoding=UTF-8 -classpath "O:\java\apache-maven-3.0.4\boot\plexus-classworlds-2.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 11.1.2\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher --no-plugin-registry --fail-fast --strict-checksums --update-snapshots -f C:\dev\shunra\Application\Builder\build\vcat\pom.xml compile
[WARNING] Command line option -npr is deprecated and will be removed in future Maven versions.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.shunra:VCat-build:pom:1.0.0.SNAPSHOT
[WARNING] 'version' uses an unsupported snapshot version format, should be '*-SNAPSHOT' instead. @ line 7, column 11
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] util.logging
[INFO] Infra
[INFO] dtos
[INFO] commons
[INFO] license
[INFO] core
[INFO] vcat
[INFO] VCat-build
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building util.logging 0.0.1
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom (7 KB at 7.2 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/19/maven-plugins-19.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/19/maven-plugins-19.pom (11 KB at 38.7 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/19/maven-parent-19.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/19/maven-parent-19.pom (25 KB at 70.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/apache/9/apache-9.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/apache/9/apache-9.pom (15 KB at 63.5 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.jar (26 KB at 63.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom (8 KB at 29.6 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/18/maven-plugins-18.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/18/maven-plugins-18.pom (13 KB at 53.6 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/16/maven-parent-16.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/16/maven-parent-16.pom (23 KB at 66.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/apache/7/apache-7.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/apache/7/apache-7.pom (15 KB at 59.5 KB/sec)
核心模块(maven artifact Id Core)应该看到依赖项公共模块(maven artifact Id commons),但它没有,这就是问题所在。
编辑3
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.shunra</groupId>
<name>VCat-build</name>
<version>1.0.0.SNAPSHOT</version>
<artifactId>VCat-build</artifactId>
<packaging>pom</packaging>
<modules>
<module>../../../util.logging</module>
<module>../../../Infra</module>
<module>../../../DTOs</module>
<module>../../../ShunraLicense</module>
<module>../../../Common</module>
<module>../../../Core</module>
<module>../../../VCat</module>
</modules>
<build>
<plugins>
</plugins>
</build>
</project>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.shunra</groupId>
<artifactId>commons</artifactId>
<version>0.0.1</version>
<dependencies>
<dependency>
<groupId>com.sun.jna</groupId>
<artifactId>jna</artifactId>
<version>3.0.9</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.4</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.7</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.shunra</groupId>
<artifactId>util.logging</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet</artifactId>
<version>2.0.10</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.8</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.8.3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- <dependency>
<groupId>com.shunra</groupId>
<artifactId>license</artifactId>
<version>0.0.1</version>
</dependency> -->
<dependency>
<groupId>com.shunra</groupId>
<artifactId>dtos</artifactId>
<version>0.0.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.org</url>
</repository>
</repositories>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source/>
<target/>
</configuration>
</plugin>
</plugins>
</build>
</project>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.shunra</groupId>
<artifactId>core</artifactId>
<version>0.0.1</version>
<dependencies>
<dependency>
<groupId>com.shunra</groupId>
<artifactId>commons</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>com.shunra</groupId>
<artifactId>license</artifactId>
<version>0.0.1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source/>
<target/>
</configuration>
</plugin>
</plugins>
</build>
</project>
编辑4
终于解决了。删除所有Intellij文件并重新导入。我想pom.xml文件的更改方式会让IntelliJ感到困惑。
查看截图,您似乎没有脱机工作,这是该问题最常见的原因。
>
尝试从Maven Projects flyout(它是左起第三个图标)下载源代码和文档。这通常有唤醒它并导致下载的效果。
使用运行时配置执行手动Maven构建。选择Edit Configurations Maven,然后确保您的工作目录是您的项目根目录,并选择一个目标“Clean Package”。这将迫使Intellij直接通过Maven进行重建,这可能会唤醒内部后台构建过程。
根据评论进一步编辑
似乎是Intellij项目同步。删除。idea目录和。iml文件就达到了目的。我已经相应地更新了名单。
我正在学习使用Maven在Eclipse中构建Java项目。我从文件夹中的“maven archetype quickstart”模板创建了一个Java项目。然后,为了将Maven项目转换为支持EclipseIDE,我导航到项目文件夹并发出命令: 和。 然后我在Eclipse中导入了该项目,并进行了必要的Eclipse配置,比如在Eclipse类路径中设置Maven本地存储库。现在,该项目位于文件
我有一个(命令行)基于maven的项目,非常好用(mvn清理、mvn验证、安装都很完美)!我现在想把它导入eclipse,不是作为maven项目,而是常规的eclipse项目。 我做到了,但我有一个依赖性问题,我只需将创建的所有jar复制到。m2文件夹到我的eclipse工作区中的另一个文件夹。然后我将所有这些罐子添加到我的项目中。 一切都好! 问题是:我觉得这不是在eclipse中管理依赖关系的
问题内容: 我正在学习使用Maven在Eclipse中构建Java项目。我从 文件夹中的“ maven-archetype- quickstart”模板创建了一个Java项目。然后,为了将Maven项目转换为支持Eclipse IDE,我导航到项目文件夹并发出命令: 和。 然后,我将项目导入Eclipse中,并进行了必要的Eclipse配置,例如在Eclipse类路径中设置Maven本地存储库。现
我得到了下面的错误,而导入maven项目从STS的git仓库。 “导入Maven项目”期间发生内部错误。没有枚举常量组织。日食m2e。果心生命周期图。模型插件执行操作。项目
我正在尝试用Maven构建一个ANTLR项目,项目结构如下所示 其中G1导入G2,类似于: 然而,当我使用Maven构建时,我得到以下错误: 如果我将和直接放在目录下,则不会有问题。在我看来,当把语法文件放在一个包中时,它需要在import语句中使用特殊的语法。 我注意到了一个问题,Antlr4 maven插件无法在不同的目录中找到语法文件,但在这里,语法在一个目录中。
我的项目结构如下: 是内的依赖项。 > 我应该在Jenkins中创建单独的作业来单独构建每个模块吗? 我为创建了一个作业,但出现以下错误(已将目标和操作设置为“清洁安装”: [INFO]扫描项目...[INFO] [INFO] ------------------------------------------------------------------------ [INFO]构建mypro