THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
- Grab the sources from svn or download servicemix source distribution.
- Open a command line and change to the source root folder. Execute the following Maven 2 command to ready the project for Eclipse. It will take around two minutes.
In case you did never use Maven before and get errors stating that some plugins or the like are missing, like for example:Code Block mvn eclipse:eclipse
execute the commands stated under "Build ServiceMix..." in the chapters Windows / Unix source installation:Code Block [SM30UG:INFO] Searching repository for plugin with prefix: 'eclipse'. Downloading: http://mirrors.sunsite.dk/maven2/org/apache/servicemix/tooling/jbi-maven-plugin/3.0-incubating/jbi-maven-plugin-3.0-incubating.jar [SM30UG:WARNING] Unable to get resource from repository central (http://repo1.maven.org/maven2) [SM30UG:INFO] ------------------------------------------------------------------------ [SM30UG:ERROR] BUILD ERROR [SM30UG:INFO] ------------------------------------------------------------------------ [SM30UG:INFO] Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository
and then retry.Code Block mvn -Dprofile=step1 mvn -Dprofile=step2
...
- In the Package Explorer find the Main class, which should be located in org.apache.servicemix/Main.java under servicemix-core/src/main/java/ and double click on the main() method.
- From the Run menu select "Run..."
- You will get a "Run" window pop-up, from there select "Java Application".
- Click on New button in botton left (Eclipse <v3.2) or the icon in the top left (Eclipse v3.2)
- Name the Project: any name you like, for example if you want to run the FilePoller / FileBinding application call it "filepoller", so it's easy for you to remember what this run configuration does.
- Click on "Arguments" tab:
- In the "Program Arguments" box enter
servicemix.xml
- In the Working Directory enter the path of your example. Such as S:\apache-servicemix\src\main\release\examples\file-binding where S:\ is assumed as your servicemix root directory.
You can use the "File System..." button to browse for your directory.
- In the "Program Arguments" box enter
- Click on the tab "Classpath" to give Eclipse needed information on where to search for executable files.
This description sticks to the file-binding example, but a similar procedure will be needed for most examples and your own code as well.
There are three main ways to add classes to the classpath:- You can add other projects of the workbench. Doing this will make the file-binding example run.
- Click "User Entries"
- Click "Add Projects" and click the checkbox(es) in front of the project(s) that are required. For convenience reasons you may click "Select All".
- Click "OK". Now your Run-dialog shall look similar to this screenshot:
- You can add JARs and classes that are stored within a path contained in the classpath environment variable. This is not required for the file-binding example, but possible, e.g. if you want to run a specific ServiceMix version from a JAR for bug reproduction - this case is used for the following description. Often, this way is used to reference dependencies Maven downloads automatically for you.
- Click "User Entries"
- Click "Advanced", "Add Classpath Variables" and "OK"
- Check M2_REPO and click "Extend"
- Choose the JAR containing the bytecode for the missing classes. If you want to run SOME_VERSION of ServiceMix, choose /org/apache/servicemix/servicemix-core/SOME_VERSION/servicemix-core-SOME_VERSION.jar
In case you want to reference a dependency, proceed in the same way. In case you do not know which package you shall select, see below at Importing ServiceMix into Eclipse #Troubleshooting.
- Click "OK"
- You can add arbitrary folders to the classpath. This is usually only needed for your own code. To explain the workflow, let's assume you did not add any projects, thus your file-binding example does not run but thows errors and the console window contains this message:
No Format Error 'Bean class [SM30UG:org.apache.servicemix.components.file.FileWriter] not found'
- Click "User Entries"
- Click "Advanced", "Add External Folder" and "OK"
- When S:\ is your servicemix root directory, select/enter S:\servicemix-components\target\classes
Why this directory? Well, have a closer look at the error message presented above. The package org.apache.servicemix.components indicates the location of the missing bean FileWriter is servicemix-components, and as we need an executable file, the target\classes subdirectory is where to look. Of course we shall proof that FileWriter really is located here, so execute dir /s FileWriter.class in the given directory and watch the output. For further hints, see below at Importing ServiceMix into Eclipse #Troubleshooting.
- Click "OK".
- You can add other projects of the workbench. Doing this will make the file-binding example run.
- Click Apply.
- Click Run.
...
No Format |
---|
Error 'Bean class [SM30UG:org.apache.servicemix.components.file.FileWriter] not found'
|
...