我有一个maven程序,它编译得很好.当我运行mvn test它时不会运行任何测试(在TESTs标题下说There are no tests to run.).
我用一个超级简单的设置重新创建了这个问题,我将在下面包含以及运行时的输出-X.
单元测试从eclipse运行良好(两者都使用默认的junit包,当我改为包含maven下载的junit.jar时).mvn也test-compile正确地在test-classes下创建了类.我在OSX 10.6.7上使用Maven 3.0.2和java 1.6.0_24运行它.
这是目录结构:
/my_program/pom.xml
/my_program/src/main/java/ClassUnderTest.java
/my_program/src/test/java/ClassUnderTestTests.java
Run Code Online (Sandbox Code Playgroud)
pom.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<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>my_group</groupId>
<artifactId>my_program</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>My Program</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
ClassUnderTest.java:
public class ClassUnderTest {
public int functionUnderTest(int n) {
return n;
}
}
Run Code Online (Sandbox Code Playgroud)
ClassUnderTestTests.java:
import org.junit.Assert;
import org.junit.Before; …Run Code Online (Sandbox Code Playgroud) 我已经尝试了几天来解决以下错误,但我无法解决它:(
我的模块的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>
<parent>
<artifactId>junitcategorizer</artifactId>
<groupId>com.topdesk.test.junitcategorizer</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>junitcategorizer.instrument</artifactId>
<name>JUnitCategorizer InstrumentationAgent</name>
<description>The agent used to instrument the called Java classes</description>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<Premain-Class>com.topdesk.junitcategorizer.instrument.InstrumentationAgent</Premain-Class>
<Agent-Class>com.topdesk.junitcategorizer.instrument.InstrumentationAgent</Agent-Class>
<Can-Redefine-Classes>true</Can-Redefine-Classes>
<Can-Retransform-Classes>true</Can-Retransform-Classes>
<Boot-Class-Path>${project.artifactId}-${project.version}.jar</Boot-Class-Path>
<Can-Set-Native-Method-Prefix>true</Can-Set-Native-Method-Prefix>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>org.ow2.asm:*</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.objectweb.asm</pattern>
<shadedPattern>org.shaded.asm</shadedPattern>
</relocation> …Run Code Online (Sandbox Code Playgroud) 我刚刚将我的Android工作室从1.0 RC 2升级到1.0.1.
之后,我被提示将gradle插件从0.14.0更新到1.0.0.
一旦我这样做,gradle构建失败与错误 -
Error:No such property: GRADLE_SUPPORTED_VERSIONS for class: com.saikoa.dexguard.h
Run Code Online (Sandbox Code Playgroud)
还有其他人遇到类似的问题吗?万分感谢 !
我的build.gradle -
buildscript {
repositories {
flatDir { dirs '../lib' } // For the DexGuard plugin.
mavenCentral() // For the Android plugin.
}
dependencies {
classpath ':dexguard:'
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'dexguard'
android {
buildTypes {
release {
proguardFiles getDefaultDexGuardFile('dexguard-release.pro'),'dexguard-project.txt'
}
debug{
//proguardFiles getDefaultDexGuardFile('dexguard-release.pro'),'dexguard-project.txt'
proguardFiles getDefaultDexGuardFile('dexguard-debug.pro'),'dexguard-project.txt'
}
}
}
Run Code Online (Sandbox Code Playgroud)