Skip to content

Commit

Permalink
WFK2-822 Revert to use FS symbolic links for Cordova project
Browse files Browse the repository at this point in the history
  • Loading branch information
VineetReynolds committed Dec 15, 2014
1 parent 69a142b commit 2889c18
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 42 deletions.
7 changes: 0 additions & 7 deletions cordova/.project
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,4 @@
<nature>org.eclipse.thym.core.HybridAppNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
<linkedResources>
<link>
<name>www</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/demo/src/main/webapp</locationURI>
</link>
</linkedResources>
</projectDescription>
4 changes: 4 additions & 0 deletions cordova/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ First we need to import the existing Hybrid Mobile project code to JBDS.
4. After selecting the TicketMonster-Cordova project, you can click on *Finish* button to start the project import.
5. Make sure that `$TICKET-MONSTER_HOME/cordova/www` is a linked folder that resolves to `../demo/src/main/webapp`.

#### Troubleshooting Windows Operating Systems

As Windows doesn't support symbolic links you must copy `$TICKET-MONSTER_HOME/demo/src/main/webapp` folder to `$TICKET-MONSTER_HOME/cordova/www`


Deploy the application on an Android Emulator
--------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions cordova/www
37 changes: 2 additions & 35 deletions tutorial/HybridUI.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -172,49 +172,16 @@ Let's proceed to add these, by searching for them and selecting them. Click `Nex
.Confirm plugins to add
image::gfx/cordova_confirm_plugin_versions.png[]
+
Once you have finished creating the project, navigate to the `www` directory, that will contain the HTML5 code of the application. Since we are reusing the TicketMonster code you can simply replace the `www` directory with a symbolic link to the `webapp` directory of TicketMonster; the `config.xml` file and `res` directory would need to be copied over to the `webapp` directory of TicketMonster. Alternatively, you can copy the code of TicketMonster and make all necessary changes there (however, in that case you will have to maintain the code of the application in both places).
Once you have finished creating the project, navigate to the `www` directory, that will contain the HTML5 code of the application. Since we are reusing the TicketMonster code you can simply replace the `www` directory with a symbolic link to the `webapp` directory of TicketMonster; the `config.xml` file and `res` directory would need to be copied over to the `webapp` directory of TicketMonster. Alternatively, you can copy the code of TicketMonster and make all necessary changes there (however, in that case you will have to maintain the code of the application in both places); on Windows, it would be easier to do this.

----
$ cp config.xml $TICKET_MONSTER_HOME/demo/src/main/webapp
$ cp res $TICKET_MONSTER_HOME/demo/src/main/webapp
$ cd ..
$ rm -rf www
$ ln -s $TICKET_MONSTER_HOME/demo/src/main/webapp www
----

Once the necessary files have been copied and the original `www` folder deleted, you can re-create the `www` directory as an Eclipse linked folder in the Hybrid Mobile project.

First select the project, right-click on it, and select the `New` -> `Folder` option in the context menu.

.Create a new Folder
image::gfx/create_new_folder.png[]

Specify the name of the folder as `www`, but do not click `Finish` yet - we need to create a linked folder.

.Specify www as the folder name
image::gfx/create_www_folder.png[]

In the same dialog box, click the `Advanced` button, to create a new `Linked Folder` (Link to alternate location). Enter the following value: `PROJECT_LOC/../ticket-monster/src/main/webapp/` in the textbox. Click _Finish_ to create the linked folder. This will link the folder to the TicketMonster project, assuming the Hybrid Mobile Project and the Java EE project reside in the same directory.

.Establish link between www and the webapp directory
image::gfx/setup_linked_folder_to_webapp.png[]

Replace `ticket-monster` with the name of the Java EE project, if you specified a different name when you originally created the Java EE project. If the TicketMonster project sources are in a different location, you should correct the link, and specify the correct location instead.

[NOTE]
==================================================
We use Linked Folders instead of file-system dependent symbolic links, as the latter are not portable across operating systems.
The `PROJECT_LOC` variable that we use in the link, represents the location of the current project. `PROJECT_LOC/../ticket-monster/` represents the `ticket-monster` (aka the Java EE project we originally created in the Introductory chapter) in the parent directory of the Hybrid Mobile project (i.e. as a sibling project, and if you've used the default locations, both of these projects would be in the same top-level workspace directory). The rest of the link's value translates to the `webapp` directory under the Java EE project.
==================================================

[WARNING]
==================================================
Once you switch to using an Eclipse Linked Folder, you may not be able to add or remove Cordova plugins from the Hybrid Mobile application project.
This is a known issue, that you can track in the https://issues.jboss.org/browse/JBIDE-18711[JBoss JIRA].
If you wish to do work around this, simply drop the linked folder, recreate a simple folder with the `config.xml` file, and proceed to add/remove the plugins.
==================================================

.The result of linking www to the webapp directory
image::gfx/link-www-directory-to-webapp.png[]

Expand Down
1 change: 1 addition & 0 deletions tutorial/generate-guides.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ do
asciidoctor -d book -b html5 -a toc2 -a copycss -a source-highlighter=highlightjs -o ${output_filename} $file
done

file=ticket-monster.asciidoc
for ((i=0; i < ${#OUTPUT_FORMATS[@]}; i++))
do
output_format=${OUTPUT_FORMATS[i]}
Expand Down

0 comments on commit 2889c18

Please sign in to comment.