我正在使用Jenkins,Maven 3.1和Java 1.6.我在Jenkins设置了以下Maven工作,具有以下目标和选项......
clean install -U -P cloudbees -P qa
Run Code Online (Sandbox Code Playgroud)
下面是我的pom.xml surefire配置...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<reuseForks>true</reuseForks>
<argLine>-Xmx2048m -XX:MaxPermSize=512M </argLine>
<skipTests>false</skipTests>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但是,当我的单元测试失败时,Jenkins控制台输出仍然显示"BUILD SUCCESS"并且构建被标记为"不稳定"而不是完全失败.我如何配置Jenkins(或Maven,如果它是什么原样)的东西,以便我的构建失败(不会变得不稳定或通过),如果任何单元测试失败?
以下是控制台输出的内容
17:08:04 MyProjectOrganizationControllerTest.testRecoverFromError » IllegalState Failed to...
17:08:04 MyProjectOrganizationControllerTest.testVerifyDistrictListPopulated » IllegalState
17:08:04 MyProjectOrganizationControllerTest.testUpdateSchool » IllegalState Failed to loa...
17:08:04 MyProjectOrganizationControllerTest.testDeleteSchool » IllegalState Failed to loa...
17:08:04 MyProjectOrganizationControllerTest.testVerifyOrgListPopulatedPrivateSchoolOrgType » IllegalState
17:08:04 MyProjectOrganizationControllerTest.testSubmitMultipleParams » IllegalState Faile...
17:08:04
17:08:04 Tests run: 155, Failures: 0, Errors: 154, Skipped: 1
17:08:04
17:08:04 [ERROR] There are test failures.
17:08:04
17:08:04 …
Run Code Online (Sandbox Code Playgroud) 我们正在使用Liquibase 3.2和Java 6.有没有办法可以强制Liquibase重新计算校验和,而无需重新运行Liquibase文件中的相同语句?在我们的数据库中,我运行这个......
update DATABASECHANGELOG set md5sum = null where 1;
Run Code Online (Sandbox Code Playgroud)
但是,当我运行我的Liquibase更改脚本时,某些执行仍然失败,并出现以下错误...
invoking liquibase change script with file /tmp/deploywork/db.changelog-master.xml
running /usr/java/liquibase/liquibase --logLevel=info --driver=com.mysql.jdbc.Driver --classpath=/usr/java/jboss/modules/com/mysql/main/mysql-connector-java-5.1.22-bin.jar --changeLogFile=/tmp/deploywork/db.changelog-master.xml --url="jdbc:mysql://myservername:3306/my_db" --username=username --password=password update
INFO 5/13/15 2:15 PM: liquibase: Successfully acquired change log lock
INFO 5/13/15 2:15 PM: liquibase: Reading from my_db.DATABASECHANGELOG
INFO 5/13/15 2:15 PM: liquibase: Successfully released change log lock
Unexpected error running Liquibase: Validation Failed:
3 change sets check sum
db.changelog-1.0.xml::1357593229391-25::rob (generated) is now: 7:5cfe9ecd779a71b6287ef2360a6979bf
db.changelog-7.0.xml::create-address-email-index::davea is now: 7:da0132e30ebd6a1bc52d9a39bb8c56d7
db.changelog-7.0.xml::add-myproject-event-object-id-col::davea is now: …
Run Code Online (Sandbox Code Playgroud) 我正在尝试添加ehcache
(v2.6.0)到我的Hibernate 4.1.5.SP1
项目,但有一些配置问题.具体来说,当我尝试使用构建配置时,我得到java.lang.NoClassDefFoundError
:org/hibernate/cache/EntityRegion
错误Hibernate
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</property>
Run Code Online (Sandbox Code Playgroud)
这是我的Maven依赖...
<hibernate.version>4.1.5.SP1</hibernate.version>
<hibernate.validator.version>4.3.0.Final</hibernate.validator.version>
<ehcacheVersion>2.6.0</ehcacheVersion>
...
<!-- Hibernate dependencies -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate.validator.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcacheVersion}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这是我用来配置它的Java代码......
Configuration config = new Configuration()
.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect")
.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver")
.setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:myprojectTestDb")
.setProperty("hibernate.connection.username", "sa")
.setProperty("hibernate.connection.password", "")
.setProperty("hibernate.connection.pool_size", "1")
.setProperty("hibernate.connection.autocommit", "true")
.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider")
.setProperty("hibernate.hbm2ddl.auto", "create-drop")
.setProperty("hibernate.show_sql", "true")
.setProperty("hibernate.current_session_context_class", "thread")
.setProperty("hibernate.cache.use_second_level_cache", "true")
.setProperty("hibernate.cache.region.factory_class", "net.sf.ehcache.hibernate.EhCacheRegionFactory")
.addAnnotatedClass(Organization.class)
.addAnnotatedClass(State.class)
.addAnnotatedClass(Country.class)
.addAnnotatedClass(Domain.class)
.addAnnotatedClass(Community.class);
final ServiceRegistry …
Run Code Online (Sandbox Code Playgroud) 我在一个多模块项目中使用Maven 3.2.3.我想生成一个checkstyle和findbugs报告,所以我配置了以下内容:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.13</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</reporting>
Run Code Online (Sandbox Code Playgroud)
但是,当我跑
mvn site:site site:deploy
Run Code Online (Sandbox Code Playgroud)
我反复得到以下警告......
[WARNING] The repository url 'https://maven-repository.dev.java.net/nonav/repository' is invalid - Repository 'java.net' will be blacklisted.
Run Code Online (Sandbox Code Playgroud)
我的pom.xml文件或〜/ .m2/settings.xml文件中没有引用此repo.如何跟踪此问题并最终解决警告?
我正在使用AWS并且我在EC2服务器上......
[dalvarado@mymachine ~]$ uname -a
Linux mydomain.org 3.14.33-26.47.amzn1.x86_64 #1 SMP Wed Feb 11 22:39:25 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)
尽管我已经安装并运行了NTPD,但我的时钟已经关闭了一分钟
[dalvarado@mymachine ~]$ sudo service ntpd status
ntpd (pid 22963) is running...
Run Code Online (Sandbox Code Playgroud)
它会出现ntp数据包被阻止或存在其他问题,因为我收到此错误...
[dalvarado@mymachine ~]$ sudo ntpdate pool.ntp.org
2 Apr 16:43:50 ntpdate[23748]: no server suitable for synchronization found
Run Code Online (Sandbox Code Playgroud)
有没有人知道AWS是否有另一台服务器我应该联系NTP信息,或者我还需要其他其他配置吗?
谢谢, - 戴夫
编辑:包括评论的输出...
[dalvarado@mymachine ~]$ sudo ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
173.44.32.10 .INIT. 16 u - 1024 0 0.000 0.000 0.000 …
Run Code Online (Sandbox Code Playgroud) 我正在使用Windows XP和最新版本的Cygwin.如果我在Windows系统中设置以下环境变量
JBOSS_HOME=C:/Program Files/jboss-4.2.3.GA
Run Code Online (Sandbox Code Playgroud)
然后启动Cygwin,我无法切换到继承的$ JBOSS_HOME目录.
$ cd $JBOSS_HOME
cygwin warning:
MS-DOS style path detected: C:/Program
Preferred POSIX equivalent is: /cygdrive/c/Program
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
-bash: cd: C:/Program: No such file or directory
Run Code Online (Sandbox Code Playgroud)
是否可以在Windows环境中定义我的系统变量一次,然后让Cygwin解释它,以便我不会得到这个"没有这样的文件或目录"警告?
我刚刚在WinXP上安装了MySQL 5.5.27.当我打开命令提示符(开始 - >运行,并键入"cmd")时,我可以通过运行"mysql -u root -p"来访问MySQL.但是,当我打开Cygwin终端并尝试相同的操作时,我收到此错误
$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql.sock' (2)
Run Code Online (Sandbox Code Playgroud)
实际上,没有"/var/run/mysql.sock"文件.
我正在使用Hibernate 4.1.3.Final与JPA 2.1和MySQL 5.5.37.我有一个具有以下字段的实体:
@Entity
@Table(name = "category",
uniqueConstraints = { @UniqueConstraint(columnNames = { "NAME" })}
)
public class Category implements Serializable, Comparable<Category> {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "ID")
@GeneratedValue(generator = "uuid-strategy")
private String id;
@NotEmpty
private Set<Subject> subjects;
...
}
Run Code Online (Sandbox Code Playgroud)
没有简单的连接表来链接该subjects
字段,而是有一个稍微复杂的MySQL查询.以下是给出特定类别ID的主题的示例:
SELECT DISTINCT e.subject_id
FROM category c, resource_category rc, product_resource pr,
sb_product p, product_book pe, book e
WHERE c.id = rc.category_id
AND rc.resource_id = pr.resource_id
AND pr.product_id = p.id
AND p.id …
Run Code Online (Sandbox Code Playgroud) 我在Mac 10.9.5上使用Maven 3.2.3并将其用于我的编译器插件...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgument>-proc:none</compilerArgument>
<fork>true</fork>
<!-- <compilerId>eclipse</compilerId>-->
</configuration>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我有我的surefire-plugin配置...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<reuseForks>true</reuseForks>
<argLine>-Xmx2048m -XX:MaxPermSize=512M -XX:-UseSplitVerifier ${argLine}</argLine>
<skipTests>${skipAllTests}</skipTests>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但是,在运行"mvn clean install"时,我收到此警告......
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseSplitVerifier; support was removed in 8.0
Run Code Online (Sandbox Code Playgroud)
什么是Java 8等效的"UseSplitVerifier"?
我正在将一个运行在MySQL 5.5 db上的Hibernate(v 4.1.5.SP1,验证器4.3.0.Final)应用程序(一个Jar文件)部署到JBoss 4.2.3.GA(无法更改).我在运行应用程序时收到错误"org.hibernate.cache.NoCachingEnabledException:二级缓存未启用",但似乎我已经正确配置了每个标记.我正在使用这些Maven依赖项......
<!-- Hibernate dependencies -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate.validator.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>${hibernate.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
错误很奇怪,因为我在hibernate.cfg.xml文件中配置了缓存...
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.datasource">java:/MySqlDS</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Caching -->
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
<mapping class="org.mainco.subco.orgsclient.model.Organization" />
<mapping class="org.mainco.subco.orgsclient.model.Community" />
<mapping class="org.mainco.subco.orgsclient.model.Domain" />
<mapping class="org.mainco.subco.orgsclient.model.State" />
<mapping class="org.mainco.subco.orgsclient.model.Country" />
</session-factory> …
Run Code Online (Sandbox Code Playgroud)