0

I have an already Java project build with Ant which I want to import in eclipse. A simple procedure is followed.

File-->New--->Java--->Java Project From Existing Build File

I selected a build file and check the box for

Link to the existing build file in the system

It created a project folder in Package Explorer with following contents

  • java folder
  • Referenced Libraries
  • build.xml

There is no src folder hierarchy where actual java files reside. The content of my build.xml are:

<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~     http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied.  See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->

<project default="run">

<property name="carbon.home" value="../../.."/>
<property name="src.dir" value="src/main/java"/>
<property name="resources.dir" value="src/main/resources"/>
<property name="temp.dir" value="temp"/>
<property name="lib.dir" value="../../lib"/>
<property name="class.dir" value="${temp.dir}/classes"/>
<property name="main-class" value="org.wso2.carbon.sample.http.Http"/>
<property name="username" value="admin"/>
<property name="password" value="admin"/>

<property name="url" value=""/>
<property name="sn" value=""/>
 <property name="filePath" value="&quot;&quot;"/>

<path id="javac.classpath">
    <pathelement path="${class.dir}"/>
    <fileset dir="${lib.dir}"/>
    <fileset dir="${carbon.home}/repository/components/plugins/">
        <include name="org.wso2.carbon.logging_*.jar"/>
        <include name="commons-pool_*.jar"/>
        <include name="httpclient_*.jar"/>
        <include name="httpcore_*.jar"/>
        <include name="commons-httpclient_*.jar"/>
        <include name="commons-codec_*.jar"/>
        <include name="slf4j.log4j12_1.7.12.jar"/>
        <include name="slf4j.api_1.7.12.jar"/>
        <include name="axis2_*.jar"/>
        <include name="axiom_*.jar"/>
        <include name="wsdl4j_*.jar"/>
        <include name="XmlSchema_*.jar"/>
        <include name="neethi_*.jar"/>
        <include name="org.wso2.securevault_*.jar"/>
        <include name="com.google.gson_*.jar"/>
        <include name="libthrift_*.jar"/>
    </fileset>
</path>


<target name="clean">
    <!--<delete dir="target" quiet="true"/>-->
    <delete dir="${class.dir}" quiet="true"/>
    <delete dir="${temp.dir}"/>
</target>

<target name="init">
    <mkdir dir="${temp.dir}"/>
    <mkdir dir="${class.dir}"/>
</target>

<target name="compile" depends="init">
    <javac srcdir="${src.dir}" destdir="${class.dir}" compiler="modern">
        <include name="*/**"/>
        <classpath refid="javac.classpath"/>
    </javac>
    <copy todir="${class.dir}" overwrite="true">
        <fileset dir="${resources.dir}">
            <include name="*.properties"/>
        </fileset>
    </copy>
</target>

<target name="run" depends="compile">
    <echo> Configure -Durl=xxxx and ( -DfilePath=xxxx or -Dsn='sample number') optionally use -Dusername=xxxx -Dpassword=xxxx </echo>
    <java classname="${main-class}"
          classpathref="javac.classpath" fork="true">
        <arg value="${url}"/>
        <arg value="${username}"/>
        <arg value="${password}"/>
        <arg value="${sn}"/>
        <arg value="${filePath}"/>
    </java>
</target>

</project>

Its a sample project of http client in wso2cep. Please identify if there is something missing? Also I cant see the progress of the build process in eclipse or if I try to clean the project.

Community
  • 1
  • 1
aneela
  • 1,457
  • 3
  • 24
  • 45
  • I'm trying to understand the question...Are you trying to import an existing project? If so, could you please clarify as why you had to create a `build.xml` file, a java folder etc? – Dilini Jul 25 '16 at 13:28
  • I have an ANT project which I want to import in eclipse. This project has contents: src,temp and build.xml. When I import using above method, I dont see src folder where actual java files hierarchy stands. Am I clear enough? – aneela Jul 26 '16 at 05:01
  • oh okay, got it now. – Dilini Jul 26 '16 at 11:14

0 Answers0