You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by datech <ar...@hotmail.com> on 2006/10/02 19:43:58 UTC
Maven-TestNG with JDK 1.4 - Asserts not working
I am using JDK1.4 assert statements in TestNG test. When I try to compile the
test using Maven 2.0 (mvn test-compile), it doesn't recognize assert
statement and give compilation failure :
"BasicTest.java:[28,15] ';' expected "
on the following code.
public void basicTest() {
int cnt = getCount();
assert cnt > 0 : "COUNT NOT GREATER THAN ZERO";
}
Surefire enables the assertion by default so I don't need to specify it in
POM surefire plugin configuration. But I did try that too but it's still not
working.
Here's part of my POM
<project>
...
<build>
<sourceDirectory>src/</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-
plugin</artifactId>
<configuration>
<groups>basic</groups>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
Not sure why it's failing. Please help? Thanks
(I am able to compile the code using javac command)
--
View this message in context: http://www.nabble.com/Maven-TestNG-with-JDK-1.4---Asserts-not-working-tf2371315.html#a6606185
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Maven-TestNG with JDK 1.4 - Asserts not working
Posted by datech <ar...@hotmail.com>.
Thanks a lot. It worked.
Ken Schwartz wrote:
>
> I'm new to maven, but I believe you need to configure the maven java
> plug-in
> for anything other than Java 1.3. You do this under the plugin tag within
> the build tag. Look at:
> http://maven.apache.org/maven-1.x/plugins/java/properties.html.
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.4</source>
> <target>1.4</target>
> </configuration>
> </plugin>
>
> -----Original Message-----
> From: datech [mailto:arora_da@hotmail.com]
> Sent: Monday, October 02, 2006 1:44 PM
> To: users@maven.apache.org
> Subject: Maven-TestNG with JDK 1.4 - Asserts not working
>
>
> I am using JDK1.4 assert statements in TestNG test. When I try to compile
> the
> test using Maven 2.0 (mvn test-compile), it doesn't recognize assert
> statement and give compilation failure :
> "BasicTest.java:[28,15] ';' expected "
> on the following code.
>
> public void basicTest() {
> int cnt = getCount();
> assert cnt > 0 : "COUNT NOT GREATER THAN ZERO";
> }
>
> Surefire enables the assertion by default so I don't need to specify it in
> POM surefire plugin configuration. But I did try that too but it's still
> not
> working.
>
> Here's part of my POM
> <project>
> ...
> <build>
> <sourceDirectory>src/</sourceDirectory>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-
> plugin</artifactId>
> <configuration>
> <groups>basic</groups>
> </configuration>
> </plugin>
> </plugins>
> </build>
> ...
> </project>
>
> Not sure why it's failing. Please help? Thanks
> (I am able to compile the code using javac command)
>
> --
> View this message in context:
> http://www.nabble.com/Maven-TestNG-with-JDK-1.4---Asserts-not-working-tf2371
> 315.html#a6606185
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Maven-TestNG-with-JDK-1.4---Asserts-not-working-tf2371315.html#a6612334
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Maven-TestNG with JDK 1.4 - Asserts not working
Posted by Ken Schwartz <ke...@alascorp.com>.
I'm new to maven, but I believe you need to configure the maven java plug-in
for anything other than Java 1.3. You do this under the plugin tag within
the build tag. Look at:
http://maven.apache.org/maven-1.x/plugins/java/properties.html.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
-----Original Message-----
From: datech [mailto:arora_da@hotmail.com]
Sent: Monday, October 02, 2006 1:44 PM
To: users@maven.apache.org
Subject: Maven-TestNG with JDK 1.4 - Asserts not working
I am using JDK1.4 assert statements in TestNG test. When I try to compile
the
test using Maven 2.0 (mvn test-compile), it doesn't recognize assert
statement and give compilation failure :
"BasicTest.java:[28,15] ';' expected "
on the following code.
public void basicTest() {
int cnt = getCount();
assert cnt > 0 : "COUNT NOT GREATER THAN ZERO";
}
Surefire enables the assertion by default so I don't need to specify it in
POM surefire plugin configuration. But I did try that too but it's still not
working.
Here's part of my POM
<project>
...
<build>
<sourceDirectory>src/</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-
plugin</artifactId>
<configuration>
<groups>basic</groups>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
Not sure why it's failing. Please help? Thanks
(I am able to compile the code using javac command)
--
View this message in context:
http://www.nabble.com/Maven-TestNG-with-JDK-1.4---Asserts-not-working-tf2371
315.html#a6606185
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org