- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 quickstart 原型(prototype)生成了一个 Maven 项目。于是我得到了如下的项目结构:
|-- src
| |-- main
| | |-- java
| | |-- resources
| |-- test
| | |-- java
| | |-- resources
|-- pom.xml
我修改了“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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.apress.javaee6</groupId>
<artifactId>chapter02</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>chapter02</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.6.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.6.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
如您所见,我使用 derby。 “src/main/resources/META-INF/persistence.xml”是:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="chapter02PU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>com.apress.javaee6.chapter02.Book</class>
<properties>
<property name="eclipselink.target-database" value="DERBY"/>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.logging.level" value="INFO"/>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:derby://localhost:1527/chapter02DB;create=true"/>
<property name="javax.persistence.jdbc.user" value="APP"/>
<property name="javax.persistence.jdbc.password" value="APP"/>
</properties>
</persistence-unit>
</persistence>
然后,我创建了一个“Book”类:
package com.apress.javaee6;
import javax.persistence.*;
@Entity
@NamedQuery(name = "findAllBooks", query = "SELECT b FROM Book b")
public class Book {
// ======================================
// = Attributes =
// ======================================
@Id
@GeneratedValue
private Long id;
@Column(nullable = false)
private String title;
private Float price;
@Column(length = 2000)
private String description;
private String isbn;
private Integer nbOfPage;
private Boolean illustrations;
// ======================================
// = Constructors =
// ======================================
public Book() {
}
public Book(String title, Float price, String description, String isbn, Integer nbOfPage, Boolean illustrations) {
this.title = title;
this.price = price;
this.description = description;
this.isbn = isbn;
this.nbOfPage = nbOfPage;
this.illustrations = illustrations;
}
// ======================================
// = Getters & Setters =
// ======================================
public Long getId() {
return id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Float getPrice() {
return price;
}
public void setPrice(Float price) {
this.price = price;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public Integer getNbOfPage() {
return nbOfPage;
}
public void setNbOfPage(Integer nbOfPage) {
this.nbOfPage = nbOfPage;
}
public Boolean getIllustrations() {
return illustrations;
}
public void setIllustrations(Boolean illustrations) {
this.illustrations = illustrations;
}
// ======================================
// = hash, equals, toString =
// ======================================
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Book");
sb.append("{id=").append(id);
sb.append(", title='").append(title).append('\'');
sb.append(", price=").append(price);
sb.append(", description='").append(description).append('\'');
sb.append(", isbn='").append(isbn).append('\'');
sb.append(", nbOfPage=").append(nbOfPage);
sb.append(", illustrations=").append(illustrations);
sb.append('}');
return sb.toString();
}
}
当然还有“主类”:
package com.apress.javaee6;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
public class Main {
public static void main(String[] args) {
// Creates an instance of book
Book book = new Book();
book.setId(1231L);
book.setTitle("The Hitchhiker's Guide to the Galaxy");
book.setPrice(12.5F);
book.setDescription("Science fiction comedy series created by Douglas Adams.");
book.setIsbn("1-84023-742-2");
book.setNbOfPage(354);
book.setIllustrations(false);
// Gets an entity manager and a transaction
EntityManagerFactory emf = Persistence.createEntityManagerFactory("chapter02PU");
EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
// Persists the book to the database
tx.begin();
em.persist(book);
tx.commit();
em.close();
emf.close();
}
}
我启动 Derby 服务器:
./derby/bin/startNetworkServer
问题是当我运行主类时:
mvn exec:java -Dexec.mainClass="com.apress.javaee6.Main"
我收到以下错误:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An exception occured while executing the Java class. null
Object: Book{id=null, title='The Hitchhiker's Guide to the Galaxy', price=12.5, description='Science fiction comedy series created by Douglas Adams.', isbn='1-84023-742-2', nbOfPage=354, illustrations=false} is not a known entity type.
我认为问题出在“id=null”。但是,当我手动设置 Id 时(例如设置为 123),我会收到相同的错误消息。我还尝试在 Book 类中使用以下注释:
@GeneratedValue(strategy=GenerationType.AUTO)
或
@GeneratedValue(strategy=GenerationType.IDENTITY)
有人解决这个错误吗?
PS:这是打开错误堆栈跟踪的 exec 命令结果:
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'exec'.
[INFO] ------------------------------------------------------------------------
[INFO] Building chapter02
[INFO] task-segment: [exec:java]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing exec:java
[INFO] No goals needed for project - skipping
[INFO] [exec:java {execution: default-cli}]
[EL Finest]: 2010-08-19 13:38:37.215--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--Begin predeploying Persistence Unit chapter02PU; session file:/home/zakaria/Dev/chapter02/target/classes/_chapter02PU; state Initial; factoryCount 0
[EL Finest]: 2010-08-19 13:38:37.243--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--property=eclipselink.orm.throw.exceptions; default value=true
[EL Finer]: 2010-08-19 13:38:37.272--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--Searching for default mapping file in file:/home/zakaria/Dev/chapter02/target/classes/
[EL Finer]: 2010-08-19 13:38:37.276--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--Searching for default mapping file in file:/home/zakaria/Dev/chapter02/target/classes/
[EL Finest]: 2010-08-19 13:38:37.3--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--End predeploying Persistence Unit chapter02PU; session file:/home/zakaria/Dev/chapter02/target/classes/_chapter02PU; state Predeployed; factoryCount 0
[EL Finer]: 2010-08-19 13:38:37.3--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--JavaSECMPInitializer - transformer is null.
[EL Finest]: 2010-08-19 13:38:37.3--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--Begin predeploying Persistence Unit chapter02PU; session file:/home/zakaria/Dev/chapter02/target/classes/_chapter02PU; state Predeployed; factoryCount 0
[EL Finest]: 2010-08-19 13:38:37.301--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--End predeploying Persistence Unit chapter02PU; session file:/home/zakaria/Dev/chapter02/target/classes/_chapter02PU; state Predeployed; factoryCount 1
[EL Finest]: 2010-08-19 13:38:37.309--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--Begin deploying Persistence Unit chapter02PU; session file:/home/zakaria/Dev/chapter02/target/classes/_chapter02PU; state Predeployed; factoryCount 1
[EL Finer]: 2010-08-19 13:38:37.315--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--Could not initialize Validation Factory. Encountered following exception: java.lang.NoClassDefFoundError: javax/validation/Validation
[EL Finest]: 2010-08-19 13:38:37.323--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--property=eclipselink.logging.level; value=FINEST; translated value=FINEST
[EL Finest]: 2010-08-19 13:38:37.323--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--property=eclipselink.logging.level; value=FINEST; translated value=FINEST
[EL Finest]: 2010-08-19 13:38:37.324--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--property=javax.persistence.jdbc.user; value=APP
[EL Finest]: 2010-08-19 13:38:37.324--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--property=javax.persistence.jdbc.password; value=xxxxxx
[EL Finest]: 2010-08-19 13:38:37.429--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--property=eclipselink.target-database; value=DERBY; translated value=org.eclipse.persistence.platform.database.DerbyPlatform
[EL Finest]: 2010-08-19 13:38:37.437--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--property=javax.persistence.jdbc.driver; value=org.apache.derby.jdbc.ClientDriver
[EL Finest]: 2010-08-19 13:38:37.438--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--property=javax.persistence.jdbc.url; value=jdbc:derby://localhost:1527/chapter02DB
[EL Info]: 2010-08-19 13:38:37.439--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--EclipseLink, version: Eclipse Persistence Services - 2.0.0.v20091127-r5931
[EL Config]: 2010-08-19 13:38:37.46--ServerSession(6419763)--Connection(22664464)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--connecting(DatabaseLogin(
platform=>DerbyPlatform
user name=> "APP"
datasource URL=> "jdbc:derby://localhost:1527/chapter02DB"
))
[EL Config]: 2010-08-19 13:38:37.857--ServerSession(6419763)--Connection(25782860)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--Connected: jdbc:derby://localhost:1527/chapter02DB
User: APP
Database: Apache Derby Version: 10.6.1.0 - (938214)
Driver: Apache Derby Network Client JDBC Driver Version: 10.6.1.0 - (938214)
[EL Config]: 2010-08-19 13:38:37.857--ServerSession(6419763)--Connection(10594949)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--connecting(DatabaseLogin(
platform=>DerbyPlatform
user name=> "APP"
datasource URL=> "jdbc:derby://localhost:1527/chapter02DB"
))
[EL Config]: 2010-08-19 13:38:37.863--ServerSession(6419763)--Connection(29499086)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--Connected: jdbc:derby://localhost:1527/chapter02DB
User: APP
Database: Apache Derby Version: 10.6.1.0 - (938214)
Driver: Apache Derby Network Client JDBC Driver Version: 10.6.1.0 - (938214)
[EL Info]: 2010-08-19 13:38:37.885--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--file:/home/zakaria/Dev/chapter02/target/classes/_chapter02PU login successful
[EL Finest]: 2010-08-19 13:38:37.933--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--End deploying Persistence Unit chapter02PU; session file:/home/zakaria/Dev/chapter02/target/classes/_chapter02PU; state Deployed; factoryCount 1
[EL Finer]: 2010-08-19 13:38:38.004--ServerSession(6419763)--Thread(Thread[com.apress.javaee6.Main.main(),5,com.apress.javaee6.Main])--client acquired
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An exception occured while executing the Java class. null
Object: Book{id=1231, title='The Hitchhiker's Guide to the Galaxy', price=12.5, description='Science fiction comedy series created by Douglas Adams.', isbn='1-84023-742-2', nbOfPage=354, illustrations=false} is not a known entity type.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: An exception occured while executing the Java class. null
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. null
at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:346)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:291)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.IllegalArgumentException: Object: Book{id=1231, title='The Hitchhiker's Guide to the Galaxy', price=12.5, description='Science fiction comedy series created by Douglas Adams.', isbn='1-84023-742-2', nbOfPage=354, illustrations=false} is not a known entity type.
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:4147)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:368)
at com.apress.javaee6.Main.main(Main.java:30)
... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Thu Aug 19 13:38:38 CEST 2010
[INFO] Final Memory: 8M/68M
[INFO] ------------------------------------------------------------------------
[EL Finer]: 2010-08-19 13:38:38.213--UnitOfWork(24128584)--Thread(Thread[Finalizer,8,system])--release unit of work
[EL Finer]: 2010-08-19 13:38:38.214--ClientSession(23817301)--Thread(Thread[Finalizer,8,system])--client released
非常感谢,问候。
最佳答案
I thought that the problem was the "id=null". But, when I set the Id manually (to 123 for example), I get the same error message.
不,您不应该在使用 GeneratedValue
时设置 Id
。
Anybody has the solution to this error?
问题的根本原因是 BOOK
表未生成(因此 EclipseLink 无法正确映射 Book
实体,然后无法识别它作为一个实体)。
发生这种情况是因为您的 persistence.xml
中列出的类的完全限定名称与实际的 FQN 不匹配(com.apress.javaee6.chapter02.Book
与 com.apress.javaee6.Book
).
因此,要么更改类的包,要么修复 persistence.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="chapter02PU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>com.apress.javaee6.Book</class>
<properties>
<property name="eclipselink.target-database" value="DERBY"/>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.logging.level" value="INFO"/>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:derby://localhost:1527/chapter02DB;create=true"/>
<property name="javax.persistence.jdbc.user" value="APP"/>
<property name="javax.persistence.jdbc.password" value="APP"/>
</properties>
</persistence-unit>
</persistence>
然后运行你的 mvn exec:java -Dexec.mainClass="com.apress.javaee6.Main"
将会成功:
mvn exec:java -Dexec.mainClass="com.apress.javaee6.Main" -e+ Error stacktraces are turned on.[INFO] Scanning for projects...[INFO] Searching repository for plugin with prefix: 'exec'.[INFO] ------------------------------------------------------------------------[INFO] Building Q3521044 - Maven and the “is not a known entity type” error[INFO] task-segment: [exec:java][INFO] ------------------------------------------------------------------------[INFO] Preparing exec:java[INFO] No goals needed for project - skipping[INFO] [exec:java {execution: default-cli}][EL Info]: 2010-08-19 16:39:54.442--ServerSession(2698418)--EclipseLink, version: Eclipse Persistence Services - 2.0.0.v20091127-r5931[EL Info]: 2010-08-19 16:39:55.875--ServerSession(2698418)--file:/home/pascal/Projects/stackoverflow/Q3521044/target/classes/_chapter02PU login successful[EL Warning]: 2010-08-19 16:39:56.219--ServerSession(2698418)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.DatabaseExceptionInternal Exception: java.sql.SQLException: Table/View 'SEQUENCE' already exists in Schema 'APP'.Error Code: -1Call: CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))Query: DataModifyQuery(sql="CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))")[EL Info]: 2010-08-19 16:39:56.574--ServerSession(2698418)--file:/home/pascal/Projects/stackoverflow/Q3521044/target/classes/_chapter02PU logout successful[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------[INFO] ------------------------------------------------------------------------[INFO] Total time: 11 seconds[INFO] Finished at: Thu Aug 19 16:39:56 CEST 2010[INFO] Final Memory: 17M/88M[INFO] ------------------------------------------------------------------------
但在我看来,错误报告的很差,EclipseLink 应该报告表丢失。
关于java - Maven 和 "is not a known entity type"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3521044/
我试图理解 Maven 模块和 Maven 项目之间的区别。哪一个是什么以及我应该在哪里?谢谢 最佳答案 maven 模块就像一个 maven“子项目”。一个 Maven 项目包含 1 个或多个模块。
我们目前没有自己的存储库。因此,当我们使用 Maven 构建时,它会在当前用户的主目录中创建 .m2 存储库。 现在有两个在 Maven Central 中找不到的第三方 jar。假设其中之一是 ha
我有 Maven 项目,但在其中一台服务器上我必须在没有 Maven 的情况下构建它。 可以使用标准 JDK 命令。在哪里可以看到 Maven 在构建项目时向 JDK 发送了哪些命令? 最佳答案 Ma
我打算将 ImageJ 用于 web 应用程序,但似乎 ImageJ maven 依赖项不在中央 maven 存储库中。 我说得对吗? 当 ImageJ 2.x 发布时,这会改变吗? 最佳答案 您可以
我可以有多个 Maven 实例吗,即 Mave 2.2.1 和 Maven 3 都指向同一个本地存储库? 我的意思是我知道我可以在技术上将每个 settings.xml 指向同一个文件夹,但从长远来看
我有两个项目,项目 A 依赖于项目 B,所以通常,我的 projectA/pom.xml 中有以下部分: projectB blabla version1 我想要实现的目标非常简
在网上的许多地方,我看到它讨论了要使 maven 构建可重现,明确指定所有使用的插件的版本号很重要,这样更新的插件就不会破坏构建。推荐的方法似乎是使用 enforcer 插件。下面是我在网上找到的复制
有没有办法暂停 Maven 执行流程以提供命令提示符,以便用户可以输入文本。 然后我希望将提供的文本存储在 Maven 属性中。 如果用户输入可以被屏蔽,那将是一个奖励。 这对于避免在 pom.xml
我正在尝试使用 maven 插件将 maven java 项目的源文件夹添加到 Eclipse。 尝试使用 org.codehaus.mojo 插件时,我收到以下错误 无法在项目应用程序框架上执行目标
我有两个几乎相同的配置文件。我不想在每个配置文件中复制配置,而是希望一个配置文件从另一个配置文件“继承”,但我没有看到使用 maven 3 执行此操作的明显方法。 在 Maven 中是否可以继承配置文
我是 Maven 新手,花了大约 3 天的时间使用程序集插件生成 zip 文件,引用 http://www.petrikainulainen.net/programming/tips-and-tric
想象一下这种情况。我有一个使用 Maven 管理的开源项目,它依赖于一个不在 Maven 存储库中的知名库(例如 jpathwatch)。我怎样才能让它发挥作用? 直接的方法是将 jpathwatch
我将 Neo4j 和 MongoDB 与 Grails 一起使用,我想知道 Maven Neo4j 插件是否也为我的构建提供了 Neo4j 依赖项。 MongoDB 也是如此。 我很困惑。我应该使用什
我正在尝试同时发布多个 Maven 项目,将它们部署到 oss.sonatype.org,然后将它们发布到 Maven Central。 我有一个构建 pom,用于一起构建多个多模块项目。构建 pom
我有一个带有 maven pom.xml 的项目 4.0.0 Minimal-J Minimal-J 0.1-SNAPSHOT Minimal-J
我需要制作一个下载maven项目并打印其依赖项的小程序 像这样: MavenArtifactRepository repository = new MavenArtifactRepository("t
我有一个关于 maven 在构建过程中如何计算类路径的问题。具体来说,控制何时使用“目标/类”以及何时使用来自存储库(本地/远程)的“jar”。 我有一个版本为 1.0.0-SNAPSHOT 的项目,
我有一个 maven 项目,需要在命令行(-Dmy.property=val)设置一个属性。 我需要做的是将该字符串转换为所有大写,因为该属性是 用于通过 maven-resources-plugin
引用和转义如何对传递给 Maven 插件的参数起作用? 例如,我想将多个文件名作为参数传递给 Maven Exec 插件运行的应用程序: mvnDebug exec:java -Dexec.mainC
我在父 pom 的导入的 dependencyManagement 部分中指定了一个库版本。我确认我的有效 pom 只有一次出现这种依赖。它在依赖管理部分: org.jav
我是一名优秀的程序员,十分优秀!