我们最近转换成了maven,我真的很陌生.我已将项目导入eclipse,默认情况下"自动构建",我不知道它是做什么的.有没有办法让我看到日志消息,配置它以便我可以不使用默认目标,但每次使用不同的目标?BTW,目前,在CLI中构建很好,但是在"自动构建"打开的情况下,资源过滤在eclipse中不起作用.提前致谢!
大卫
我重新启动了我的计算机,并使用 Ubuntu 12.04 重新启动了我的 VM,然后我重新启动了 Eclipse。然后我注意到有关于构建的错误,所以我在终端的 repo 上做了一个“mvn clean install”,之后我在 Eclipse 中重新导入了 Maven 项目(当该选项仍然可用时)。导入完成后,我注意到它说 mvn 缺少 m2e 中的“解包”命令。所以我想,我需要更新软件,所以我进入“帮助”>“检查更新”,然后我猜它找到了更好的 m2e 版本,但现在“导入现有的 Maven 项目”已经消失了。我尝试定期导入它,但是 'src/java/main' 和 'src/java/test' 没有区分为不同的特殊文件夹。
有没有其他人遇到过这个问题?如果是这样,你做了什么来解决这个问题。
提前致谢,
ejay
我有一个Maven项目,其中包含"核心"和"网络"部分.我正在尝试将其转换为多个模块.
我采用了"网络"包并将它们放入新项目中.我已经将核心项目添加为依赖项,我可以在Eclipse中引用它的类.WEB-INF\lib当我构建它时,"核心"项目正确地显示在"web"项目中.
当"核心"项目的类@Autowired在"web"项目中时,问题就出现了.
在这种特殊情况下,我将服务类从"核心"自动装配到"web"项目中的一个Web服务类中.如果我将核心服务所在的软件包添加到我context:component-scan的"web"应用程序配置中,它会找到该服务,但随后该服务会引用一个存储库,该存储库引用一个实体,该实体正在寻找一个实体管理器工厂.已经在我的"核心"项目中的应用程序上下文中进行了配置.
所以似乎也许context:component-scan在"核心"项目中可能没有发生?或者,被选中的课程可能无法用于"网络"项目?
我对多模块项目完全不熟悉,所以如果有人能让我开始朝着正确的方向着手解决这个问题,我将非常感激.
如果重要的话,我在Eclipse中使用m2e和Run Jetty Run插件; 但是,当我mvn jetty:run从命令行执行a时,我似乎遇到了同样的问题.
我在Windows 7上将Eclipse Juno与Maven 3.0.5一起使用。该项目以前在Windows XP上使用,并且我已移至Windows 7 64位计算机。
我已经复制了Eclipse Spring 3,Hibernate 4和JSF 2.0项目,并且在尝试编译时出现以下错误
Plugin execution not covered by lifecycle configuration:
org.bsc.maven:maven-processor-plugin:2.0.6:process (execution: process, phase:
generate-sources)
Run Code Online (Sandbox Code Playgroud)
我尝试通过在Eclipse.ini文件中添加以下内容来对此线程中提到的内容进行尝试,但是它没有解决问题。
-vm
c:\Program Files\Java\jdk1.7.0_21\jre\bin\server\jvm.dll
Run Code Online (Sandbox Code Playgroud)
尝试构建Maven安装并清理,但问题仍然存在。
我该如何解决这个问题?任何帮助都是非常明显的。
谢谢
Maven片段
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.0.6</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<!-- source output directory -->
<outputDirectory>target/metamodel</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud) 会发生什么:我的java编译器设置从我的自定义jdk重置为默认java se1.5
当它停止:每次我点击maven-更新项目(当然在eclipse中).
我认为它与更新项目设置复选框有关.但我无法在我的pom中找到负责配置我的eclipse项目的标签.任何提示?
BTW我不能只取消选中该框,因为pom可能有其他设置对我的项目至关重要
编辑:抱歉延迟,这是我的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">
<!-- <parent> -->
<!-- <groupId>org.geomajas</groupId> -->
<!-- <artifactId>geomajas-parent</artifactId> -->
<!-- <version>1.0.9</version> -->
<!-- </parent> -->
<modelVersion>4.0.0</modelVersion>
<groupId>ne</groupId>
<artifactId>projl</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>TApp</name>
<description>Test</description>
<url>http://www.example.com/</url>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.geomajas</groupId>
<artifactId>geomajas-backend</artifactId>
<version>1.13.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.geomajas</groupId>
<artifactId>geomajas-face-puregwt</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.geomajas.plugin</groupId>
<artifactId>geomajas-plugin-geotools-all</artifactId>
<version>1.10.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.geomajas.plugin</groupId>
<artifactId>geomajas-plugin-rasterizing-all</artifactId>
<version>1.2.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.geomajas.plugin</groupId>
<artifactId>geomajas-widget-puregwt-core-all</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.geomajas</groupId>
<artifactId>geomajas-dep</artifactId>
<version>1.12.28</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement> …Run Code Online (Sandbox Code Playgroud) 使用带有m2e插件的Eclipse Luna SR1,我使用Maven创建了一个Java Web项目.
如何在项目的pom.xml中删除默认项目方面(例如CDI,JPA等)?

在项目 - >属性中取消选中"项目构面",在Maven - >更新项目后重置.
为了避免对jfxrt.jar的非法访问警告,我手动将类路径文件更改为包括访问规则:
想要的类路径条目
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
<accessrules>
<accessrule kind="accessible" pattern="javafx/**"/>
<accessrule kind="accessible" pattern="com/sun/javafx/**"/>
</accessrules>
</classpathentry>
Run Code Online (Sandbox Code Playgroud)
如果我执行pom.xml文件,则标签accessrule会被删除,新条目为
当前由pom.xml / M2E生成的类路径条目
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
Run Code Online (Sandbox Code Playgroud)
这是因为有关访问规则的信息未包含在我的pom.xml文件中。如何修改pom.xml文件以生成所需的类路径文件?
我可以对Maven-compiler-plugin使用一些配置吗?
还是我必须使用一些额外的Maven插件来修改类路径文本文件?
还是根本无法在pom.xml文件中解决此问题,而我将不得不为M2E编写功能请求?
这是我的pom.xml文件中的一个片段(我使用pom打包):
当前的pom.xml条目用于编译阶段
<!-- ### COMPILE ### phase -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<!-- specify current java version here: -->
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<id>compile-execution</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>org.treez.test-compile-execution</id>
<phase>org.treez.test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud) 安装m2e-egit插件后无法创建maven项目; 显然我没有在Eclipse> Window> preferences下看到maven选项
使用的工具:
Eclipse Java EE IDE for Web Developers.
Version: Mars Release (4.5.0)
Run Code Online (Sandbox Code Playgroud) 我想用不同的配置文件运行maven但它似乎不起作用.我为我的JPAConfiguration创建了2个不同的java类:
JPAConfiguration.class和JPAConfigurationTest.class
@Configuration
@Profile({"dev"})
@EnableTransactionManagement(proxyTargetClass = true)
@EnableJpaRepositories(basePackages = { "com.jle.athleges.model.repository", "com.jle.athleges.security.repository" })
@ComponentScan(basePackages = { "com.jle.athleges.model.services", "com.jle.athleges.security.services" })
public class JpaConfiguration {
@Bean
public DataSource dataSource() throws SQLException {
System.out.println("use dev");
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
builder.setName("dev");
return builder.setType(EmbeddedDatabaseType.H2).build();
}
@Bean
public EntityManagerFactory entityManagerFactory() throws SQLException {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(true);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("com.jle.athleges.model.entity", "com.jle.athleges.security.entity");
factory.setDataSource(dataSource());
factory.afterPropertiesSet();
return factory.getObject();
}
@Bean
public EntityManager entityManager(EntityManagerFactory entityManagerFactory) {
return entityManagerFactory.createEntityManager();
}
@Bean
public PlatformTransactionManager transactionManager() …Run Code Online (Sandbox Code Playgroud)