Finalmente, leo un artÃculo de alguien que habla en contra de las redes sociales. Y estoy muy de acuerdo. Personalmente, todo este tema de las redes sociales, al menos de la manera en que están generalmente encaradas, nunca me terminó de convencer. Tal como dice el artÃculo, pareciera ser un amontonamiento de gente que muy bien no se sabe para que o por que se juntan, y lo que podrÃa tener cierto sentido, se termina diluyendo en tanta heterogeneidad. Me recuerda a esos portales horizontales que habÃa al principio de la web, que querÃan ser mucho y terminaban siendo nada. Además, más allá de lo bueno que creativamente y tecnológicamente sean estas redes, tiene que haber un modelo de negocio que las sostenga, y pareciera que no lo hay (no al menos donde lo están buscando).
No me malentiendan, no es que creo que las redes sociales no deberÃan existir, de hecho tengo mi usuario en Facebook (aunque más que nada por una cuestión de trabajo, ya que tengo que hacer una aplicación para integrar Facebook con una aplicación de mi empresa), y a su vez tengo un proyecto personal (que no sé si algún dÃa verá la luz) basado en la idea de redes sociales.
Lo qué sà creo es que, a la vista de la inviabilidad de los portales horizontales, las redes sociales también deberán apuntar a un nicho en particular. Un ejemplo podrÃa ser LinkedIn, que intenta crear vÃnculos entre profesionales de las mismas áreas, y aparentemente lo consigue, conozco el caso de un amigo mÃo que consiguió un importantÃsimo contrato para su empresa con una compañÃa europea a través de office furniture in Bulgaria
LinkedInoffice furniture in Bulgaria
. Pero Facebook quiere ser todo, quiere tener a toda la población del mundo, con aplicaciones de cualquier tipo. Veremos como sigue esto.
Finally, I read an article from someone talking against social networks, and I really agree. Personally, I’ve been never much into this whole thing about social networks. As the article says, it seems to be a whole lot of people who don’t know why or what for they’re “together”. It reminds me of the horizontal portals from the web early years, which tried to be everything, but in the end were nothing. And beyond the creative or technological achievements, there’s always a need for a working business model, but it seems like there’s not (at least not where they’re looking for).
Don’t take me wrong, is not that I’m all against social networks, as a matter of fact I have my Facebook profile (although is more because of a work matter, as we’re developing a Facebook applications to interact with one of my company’s applications), and I even have a personal project (don’t really know if it’ll be ever released someday!) based on the social network idea.
But I believe, after seeing what happened with horizontal portals, that social network should also put their aim in specific niches. An example could be LinkedIn, which try to create links between professional people within the same area of expertise, and it seems to work, as a friend of mine company recently obtained a lucrative contract with an European company through LinkedIn. But Facebook wants to be everything, have profiles for the whole world population, and applications of any type. Let’s see how it goes.
Powered by ScribeFire.
Hace tiempo vengo usando
Maven2 y
Eclipse con WTP. Para mà es una muy buena combinación, porque ambos ofrecen muy interesantes opciones:
Maven2:
- Automatiza totalmente el proceso de building,y permite customizarlo a gusto.
- Maneja las dependencias del proyecto de una manera bastante eficiente.
- Se integra fácilmente con Ant, por lo tanto también cuenta con la flexibilidad y las innumerables opciones de éste.
- Facilita el proceso de integración continua, ejecutando los tests, reportes de cobertura, estilos de programación, etc.
Eclipse WTP:
- Permite ejecutar un container o appserver dentro de Eclipse, posibilitando asà el debug de aplicaciones, y el hot deploying, o sea no tener que rearrancar el container para ver los cambios hechos en una clase, un JSP u otro tipo de archivo. Se puede debuggear incluso un JSP.
- Tiene un buen editor JSP/HTML/XML con autocompletar, y la version 2.0 tiene incluso un editor gráfico HTML (aunque hace agua con css).
El problema es que los dos no se integran fácilmente. WTP necesita una estructura de directorio que es diferente a la de Maven. Además, si bien Maven descarga las dependencias automáticamente, las guarda en su propio repositorio local que no tiene nada que ver con WTP, y por lo tanto hay que copiar los .jar manualmente a donde WTP las pueda encontrar para cuando hace sus propios deploys internos.
Después de un par de dÃas de prueba y error, ya que la documentación en este sentido es escasa, encontré la manera de integrarlos 100%, con la ayuda del plugin de Elipse para Maven. Estos son los pasos a seguir, lo tengo probado y funciona muy bien. Asumo que tienen un mÃnimo conocimiento de Maven y de la estructura del pom.xml, sino les recomiendo que lean antes este breve tutorial. Las versiones que usé son Maven 2.0.7, puede que funcione con alguna versión anterior de la rama 2, pero definitivamente es necesario WTP 2.0 o superior.
- Partimos de un proyecto web que tiene una estructura de directorios casi igual a la que propone Maven:
.
|-- pom.xml
|-- WebContent
| |-- WEB-INF
| | `-- web.xml
| |-- index.jsp
| `-- jsp
| `-- websource.jsp
`-- src
`-- main
|-- java
| `-- com
| `-- example
| `-- projects
| `-- SampleAction.java
|-- test
| `-- com
| `-- example
| `-- projects
| `-- SampleActionTest.java
`-- resources
|-- log4j.properties
`-- hibernate.properties
- Si el proyecto ya está armado y no tiene esta estructura, bueno, o adaptan la estructura a esto, o se buscan otra manera de hacer la integración.

La diferencia con el standard de Maven, es que pusimos todos los archivos web en WebContent en vez de en src/main/webapp.
Lamentablemente el plugin de Maven para Eclipse (que crea automáticamente un proycto para Eclipse en base al pom.xml) no soporta WTP 2.0, asique no lo pude probar y no sé como será la integración. Esperemos que pronto soporten WTP 2.0.
- Este proyecto se puede migrar a Eclipse (si aún no lo está) haciendo File -> New -> Other -> Web -> Dynamic Web Project, desmarcando Use default e ingresando el directorio donde esta ubicado el proyecto. Lamentablemente los paths presentados no se pueden cambiar para nuestra conveniencia, ya que el campo no acepta valores que incluyan / , por lo tanto lo dejamos asà y lo arreglaremos luego. Una vez abierto este proyecto en Eclipse, si queremos ejecutarlo en un container, o realizar un build con Maven, veremos que no funciona en ninguno de los dos casos por los siguiente motivos:
- Los nombres de los packages estan mal, ya que comienzan con main.java
- El web.xml en WebContent/WEB-INF/web.xml es uno creado por WTP, no el de nuestro proyecto, y Maven no encuentra ningúno de los archivos web (por ej. html, jsp, js, jpg, etc), ya que espera que estén en src/main/webapp.
- WTP no encuentra ninguno de los archivos de recursos que usualmente deben aparecer en el classpath (por ej. .properties, .xml, etc)
- Finalmente, WTP no encuentra ningún .jar externo, ya que estos estan en el repositorio
de Maven en ~/.m2/repo y WTP los espera en WebContent/WEB-INF/lib
Veamos entonces como solucionar cada uno de estos problemas.
- Para solucionar los packages, vamos a Java Build Path -> Source y removemos el único directorio de la lista. Luego seleccionamos Add Folder, y elegimos los directorios que contienen los archivos . java, o sea src/main/java y src/test/java. De esta manera, los packages quedan como corresponde.
- Para que el build funcione en Maven, vamos a decirle donde encontrar los archivos web. Para eso agregamos al pom.xml las siguientes lineas en la sección de plugins:
maven-war-plugin WebContent
Ahora deberÃa funcionar el build con Maven, lo podemos probar haciendo mvn clean install desde el directorio del proyecto.
- Para solucionar el tema de los recursos, haremos un truquito. Vamos a Java Build Path -> Source y seleccionamos Link Source… En Linked folder location ingresamos el path hacia nuestro directorio de resources src/main/resources. El Folder name puede ser cualquiera. Recomiendo en este paso, crear una variable PROJECT_HOME o algo asÃ, que apunte directo al root de nuestro proyecto, de manera de hacerlo portátil, si luego queremos mover el proyecto a otro directorio o PC, o dárselo a otra persona, bastará con cambiar esta variable para que el proyecto funcione en otra ubicación.
Esto hace que el directorio resources sea incluido en el classpath, y en el deploy interno vayan a quedar en WEB-INF/classes.
- Para que WTP vea los .jar, vamos a utilizar el plugin de Eclipse para Maven, que también además nos va a posibilitar correr Maven dentro de Eclipse, y facilitar la tarea de agregar dependencias.
Una vez instalado, veremos que el archivo pom.xml aparece decorado con una pequeña m en la esquina superior izquierda del Ãcono. Con el botón derecho clickeamos en el root del proyecto, y en el menú elegimos Maven2 -> Enable. Inmediatamente, esta acción agrega a nuestro proyecto una nueva biblioteca llamada Maven 2 Dependencies, que contiene todas las dependencias detalladas en el pom.xml. Esto es suficiente para que todas las dependencias estén en el classpath, por lo que el proyecto deberÃa compilar en Eclipse sin problemas. Sin embargo, WTP aún necesita que las dependencias estén en WebContent/WEB-INF/lib para que en el momento de hacer el deploy interno, estas esten en el lugar que el container las necesita.
Para lograr este último detalle, vamos a las properties del proyecto, y en J2EE Module Dependencies, seleccionamos la biblioteca Maven 2 Dependencies. De esta manera le decimos a WTP que incluya también las dependencias de Maven en WEB-INF/lib de su deploy interno.
Una vez seguidos todos estos pasos, deberÃa ser posible arrancar un container dentro de Eclipse (yo particularmente uso Tomcat 5.5 ó 6) y ejecutar nuestro proyecto como una webapp. Adicionalmente, podremos realizar builds con Maven también desde dentro de Eclipse seleccionando con el botón derecho en el root del proyecto y eligiendo el Run as… apropiado. Finalmente, para agregar una nueva dependencia, seleccionamos con el botón derecho el pom.xml, elegimos Maven2 -> Add Dependency y en el espacio para Query escribimos parte del nombre de la dependencia que buscamos. Casi inmediatamente aparecerá un árbol con los resultados encontrados, que debemos navegar hasta encontrar el paquete deseado, y simplemente eligéndolo, el .jar de descargará del repositorio central hacia nuestro repositorio local, se agregará la dependencia al pom, y también a la biblioteca de dependencias de Maven de nuestro proyecto, y por lo tanto también al deploy interno de WTP.
Nota: no elijan la opción del proyecto Maven2 -> Update Source Folders, no sé exactamente cuál es su objetivo, pero el efecto inmediato es que hace que el link que habÃamos creado hacia el directorio de recursos no sea mas un link, y entonces por algún motivo el WTP no lo incluye en su deploy interno.
Nota2: es posible que los recursos en el link no se deployeen automáticamente al modificarlos, si esto ocurre será suficiente con hacer un refresh (F5) del directorio linkeado.
Conclusiones
Tener Maven2 integrado con Eclipse WTP facilita mucho la tarea de todo el ciclo de desarrollo de una webapp.
Partiendo de esta base, se pueden luego agregar mas directorios de recursos, generar builds con cambios o bien con otras estructuras, generar diferentes builds en base al mismo código, etc. La documentación de Maven2 no es la gran cosa, pero con un poco de perseverancia de pueden obtener los resultados deseados.
I’ve been using Maven2 and Eclipse with WTP for a long time. To me they make a good match, because they offer very attractive options:
Maven2:
- Complete automation of the building process, and ad-hoc customization.
- Handles project dependencies in a rather efficient way.
- Easily integrated with Ant, so it has its flexibility and countless options.
- Eases the continuous integration process, by executing tests, coverage reports, programming styles, etc.
Eclipse WTP:
- Allows execution of a container or appserver inside Eclipse, so it’s possible to debug applications (even JSP’s) , and hot deploying, so there’s no need to restart the server every time a class, a JSP or other file changes.
- It has a good autocomplete JSP/HTML/XML editor. Version 2.0 even has a graphical HTML editor (although it has some problems with css).
The problem is they don’t integrate easily. WTP needs a specific directory structure which is different than Maven’s. Even though Maven downloads dependencies automatically, it stores them in its own local repository which has nothing to do with WTP, and therefore .jar files need to be manually copied where WTP will be able to find them to do its own internal deploys.
After a couple of days on trial and error (since documentation is non-existent), I’ve found the way to integrate them 100%, with help from Eclipse plugin for Maven. These are the steps to follow, I have tested it and it works great. I assume you have a basic knowledge of Maven and pom.xml structure, if not, I would recommend this brief tutorial. The versions I used were Maven 2.0.7 and WTP 2.0., it might work with previous 2.0x branch of Maven.
- Let’s start with a project with a directory structure almost as proposed by Maven:
.
|-- pom.xml
|-- WebContent
| |-- WEB-INF
| | `-- web.xml
| |-- index.jsp
| `-- jsp
| `-- websource.jsp
`-- src
`-- main
|-- java
| `-- com
| `-- example
| `-- projects
| `-- SampleAction.java
|-- test
| `-- com
| `-- example
| `-- projects
| `-- SampleActionTest.java
`-- resources
|-- log4j.properties
`-- hibernate.properties
If the project is already going with a different structure, well, you will need to adapt it, or find another way to make the integration work.
The difference with standard Maven is we placed all the web files in WebContent instead of src/main/webapp.
Unfortunately, Maven for Eclipse plugin (which automatically builds an Eclipse project based on pom.xml) currently doesn’t support WTP 2.0, so I couldn’t test it and I don’t know how integration would be. Hopefully they will support WTP 2.0 soon.
- This project can be migrated to Eclipse, (if it’s not yet) doing File -> New -> Other -> Web -> Dynamic Web Project, unchecking Use default and entering the directory where the project is. For some reason the paths cannot be changed to suits us, since strangely the field won’t accept values including “/”, so we’ll leave it as it is, and we’ll fix it later. Once the project is opened in Eclipse, if we want to run it in a container o make a build with maven, it won’t work because of the following reasons:
- Packages names are wrong, they start with main.java
- The web.xml at WebContent/WEB-INF/web.xml is one created automatically by WTP, not our project’s, and Maven can’t find none of the web files (.html, .jsp, .js, .jpg, etc.), since they’re supposed to be found at src/main/webapp.
- WTP can’t find any of the resource files usually found in the classpath (i.e. .properties, .xml, etc)
- Finally, WTP can’t find any external .jar, since these are in the Maven repository in ~/.m2/repo and WTP wants them on WebContent/WEB-INF/lib
Veamos entonces como solucionar cada uno de estos problemas.
- To fix packages, go to Java Build Path -> Source and remove the only directory on the list. Then select Add Folder, and choose the directories containing the .java files, namely src/main/java y src/test/java. This way, packages are fixed.
- To make the build work in Eclipse, let it know where to find the we files. Add the following lines to the pom.xml, in the plugins section:
maven-war-plugin WebContent
Now the Maven work should be working, we could try it by doing mvn clean install freom the project home directory.
- To fix the resources, let’s do a small trick. Go to Java Build Path -> Source and select Link Source… At Linked folder location enter the path to our resources directory src/main/resources. The Folder name ma be any. I’d suggest creating a variable PROJECT_HOME or something, pointing to our project root, and then extending the link folders from there, so it’ll be portable, if we later move this project to other location or PC, or give it to someone else, it’ll be as easy as changing this variable for the project to work from another location.
This will cause the resources directory will be included in the classpath, and the internal deploy will put it in WEB-INF/classes.
- To make WTP find the .jar, we’ll use Eclipse for Maven plugin, which will also allow us to run Maven from isnide Eclipse, and make it easy to add dependencies.
Once installed, the pom.xml file will appear decorated with a small m at the top left corner of its icon. Right-click on the project root, and choose Maven2 -> Enable from the menu. This will add a new library named Maven 2 Dependencies to our project, containing all the dependencies detailed in the pom.xml. This is enough for the whole lot of dependencies to be in the classpath , so the project should compile inside Eclipse with no problems now. However, WTP still needs the dependencies to be at WebContent/WEB-INF/lib to make the internal deploy.
For this last detail, go to project properties, and at J2EE Module Dependencies, select the library Maven 2 Dependencies. This way, we’re letting WTP know to include Maven dependencies at WEB-INF/lib in its internal depoly.
Once all these steps are done, should be possible to satart a container inside Tomcat (I used Tomcat 5.5 or 6) and run our project as a webapp. We should be able to make builds with Maven from inside Eclipse as well, right-clicking on the project root and choosing the appropriate Run as… Finally, to add a new dependency. right-click on pom.xml and choose Maven2 -> Add Dependency, and in the query field we write part of the name of the dependency. Almost immediately, a tree with the found results will appear, we simply move until we find the desired package and choose it. The dependency will be added to the pom, the .jar will be downloaded into our local repository, and added to the Maven dependency library, therefore to the WTP internal deploy.
Note: don’t choose the project option Maven2 -> Update Source Folders, I don’t know exactly what its purpose is, but the immediate effect is to make the link created to the resource folder no longer a link, so WTP will not include it in its internal deploy.
Note 2: sometimes the resources in the link don’t deploy automatically when modified. To force a deploy, it’s as easy as refresh (F5) the linked folder.
Conclusions
To have Maven2 integrated into Eclipse WTP eases the whole development cycle of a webapp.
Starting with this, more resource folders, different builds with changes or different structures, different builds based on the same basecode, etc., can be added later. Maven2 documentation was never that great, but with a bit of patience the desired objectives can be achieved.
Powered by ScribeFire.