0

I'm trying to compile my maven test project in intellij and everytime i compile, i get this error:

Buildfile: /Users/username/Desktop/workFiles/maven/MavenProject/build.xml

setClassPath:

init:

clean:
   [delete] Deleting directory /Users/username/Desktop/workFiles/maven/MavenProject/build

compile:
     [echo] making directory...
    [mkdir] Created dir: /Users/username/Desktop/workFiles/maven/MavenProject/build
     [echo] classpath------: /Users/username/Desktop/workFiles/maven/MavenProject/target/MavenProject-1.0-SNAPSHOT.jar
     [echo] compiling...
    [javac] Compiling 2 source files to /Users/username/Desktop/workFiles/maven/MavenProject/build
    [javac] /Users/username/Desktop/workFiles/maven/MavenProject/src/test/java/com/acton/AppTest.java:5: package org.openqa.selenium does not exist
    [javac] import org.openqa.selenium.WebDriver;
    [javac]                           ^
    [javac] /Users/username/Desktop/workFiles/maven/MavenProject/src/test/java/com/acton/AppTest.java:6: package org.openqa.selenium.firefox does not exist
    [javac] import org.openqa.selenium.firefox.FirefoxDriver;
    [javac]                                   ^
    [javac] /Users/username/Desktop/workFiles/maven/MavenProject/src/test/java/com/acton/AppTest.java:15: cannot find symbol
    [javac] symbol  : class WebDriver
    [javac] location: class com.acton.AppTest
    [javac]         WebDriver driver = new FirefoxDriver();
    [javac]         ^
    [javac] /Users/username/Desktop/workFiles/maven/MavenProject/src/test/java/com/acton/AppTest.java:15: cannot find symbol
    [javac] symbol  : class FirefoxDriver
    [javac] location: class com.acton.AppTest
    [javac]         WebDriver driver = new FirefoxDriver();
    [javac]                                ^
    [javac] 4 errors

BUILD FAILED
/Users/username/Desktop/workFiles/maven/MavenProject/build.xml:78: Compile failed; see the compiler error output for details.

Here is my build.xml file:

<!-- ========== Initialize Properties =================================== -->
<property environment="env"/>

<property name="wspace.jars"            value="${basedir}"/>
<property name="wspace.jars"            value="/Users/un/.m2/repository"/>
<property name="test.dest"              value="${wspace.jars}/build"/>
<property name="test.src"               value="${wspace.jars}/src"/>
<property name="test.reportsDir"        value="/Users/username/Desktop/workFiles/maven/reports"/>



<path id="testcase.path">


    <pathelement location="${test.dest}"/>

    <fileset dir="${wspace.jars}">
      <include name="*.jar"/>
    </fileset>

  </path>




<target name="setClassPath" unless="test.classpath">
    <path id="classpath_jars">
        <fileset dir="${wspace.jars}" includes="**/*.jar"/>
    </path>
    <pathconvert pathsep=":" 
        property="test.classpath" 
        refid="classpath_jars"/>
</target>

<target name="init" depends="setClassPath">
    <tstamp>
        <format property="start.time" pattern="MM/dd/yyyy hh:mm aa" />
    </tstamp>
    <condition property="ANT"
               value="${env.ANT_HOME}/bin/ant.bat"
               else="${env.ANT_HOME}/bin/ant">
        <os family="mac" />
    </condition>

</target>

<!-- all -->
<target name="all">
</target>

<!-- clean -->
<target name="clean">
    <delete dir="${test.dest}"/>
</target>

<!-- compile -->
<target name="compile" depends="init, clean" > 
    <delete includeemptydirs="true" quiet="true">
        <fileset dir="${test.dest}" includes="**/*"/>
    </delete>
    <echo message="making directory..."/>
    <mkdir dir="${test.dest}"/>
    <echo message="classpath------: ${test.classpath}"/>
    <echo message="compiling..."/>

    <javac 
        debug="true"
        includeantruntime="true"
        destdir="${test.dest}"
        srcdir="${test.src}"
        target="1.5"
        classpath="${test.classpath}"
    />

  </target>

<!-- build -->
<target name="build" depends="init">
</target>




<target name="usage">
    <echo>
        ant run will execute the test
    </echo>
</target>

<path id="test.run">
        <fileset dir="${wspace.jars}" includes="**/*.jar"/>
</path>


<!-- run -->
<target name="run" >  
    <delete includeemptydirs="true" quiet="true">
                <fileset dir="${test.reportsDir}" includes="**/*"/>
            </delete>
            <java jar="${wspace.jars}" fork="true" spawn="true" />  
            <junit fork="yes" haltonfailure="no" printsummary="yes">
                <classpath refid="test.run" />  

              <!--  <classpath ="${test.classpath}"/> -->  
            <batchtest  todir="${test.reportsDir}" fork="true">  
            <fileset dir="${test.dest}">  


 <include name="AppTest.class" />




            </fileset>  
            </batchtest>    
                <formatter type="xml" />  
                <classpath refid="testcase.path" />  
        </junit>
            <junitreport todir="${test.reportsDir}">    
                <fileset dir="${test.reportsDir}">  
                    <include name="TEST-*.xml" />  
                </fileset>  
                <report todir="${test.reportsDir}" />  
            </junitreport>
        </target>

Not sure where im doing wrong, any help is appreciated!

1
  • Is this Maven or Ant? You listed both. May 12, 2015 at 12:32

1 Answer 1

1

Most likely, Selenium is not in your class path, which appears to be exactly /Users/username/Desktop/workFiles/maven/MavenProject/target/MavenProject-1.0-SNAPSHOT.jar.

It is surprising that you refer to this as a Maven project, and yet you choose to build it with Ant. Maven is also a build tool, and I believe IntelliJ can build using Maven if you configure your IntelliJ module the right way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.