Po komentarzu Krzyśka do wpisu Pierwsze kroki z UML w NetBeans 6.1, w którym wspomniał o MDA i lekturze artykułu Mariusza Wójcika Spring Framework - projektowanie aplikacji w oparciu o koncepcję MDA nie miałem wątpliwości, że po wczorajszej zabawie z UML dzisiaj pora spróbować sił z MDA - Model-Driven Architecture. Podejście MDA pozwala na tworzenie aplikacji bazując na modelach UML niezależnie od docelowego środowiska uruchomieniowego i użytych technologii, które są transformowane do aplikacji wynikowej za pomocą pewnych magicznych transformat. W innych słowach możnaby założyć, że wystarczy jedynie trochę porysować i po dodaniu pewnych atrybutów utworzenie aplikacji to jedynie wydanie polecenia Generate. Trochę się człowiek nasłuchał o tego typu programowaniu, że fajne i takie tam, ale praktycznej wiedzy żadnej. Czas to zmienić.
Rozpocząłem od wspomnianego artykułu Mariusza, a później zajrzałem na strony AndroMDA. Zacząłem od dostępnej dokumentacji, gdzie w Environment Setup napisano:
Install Maven - A repository containing all versioned dependencies. This repository is used during the build and deploy processes (very similar to the .NET Global Assembly Cache concept).
Użycie Mavena do tworzenia aplikacji zawsze spotyka się z moją aprobatą, więc nie miałem złudzeń, że dzisiaj będzie znowu przyjemnie. Wzmianka o .Net w kontekście Mavena była zaskakująca. Może ktoś coś napisać o tym .NET Global Assembly Cache w kilku krótkich, żołnierskich zdaniach? Ja tu wierzę, że pomysły nowatorskie płynące z projektów otwartych, a tu się okazuje, że w .Net to już dawno wszystko (?) było ;-)
Właśnie niedawno wyszła wersja Apache Maven 2.0.9, więc przy okazji uaktualnimy ją i popróbujemy się z AndroMDA.
Uwaga na potencjalny błąd w tandemie Maven-AndroMDA:
(Note that as of this writing, the latest version of Maven is 2.0.7, but it has a minor issue with AndroMDA 3.2 - this has been fixed in the latest snapshot release. Advanced users may wish to install Maven 2.0.7, but you will have to manually delete the section in app\pom.xml.)
Dzisiejszy pomysł to stworzenie aplikacij webowej z wykorzystaniem AndroMDA, które realizuje specyfikację MDA. Zamiast, jak to polecano w dokumentacji AndroMDA, uruchomienia aplikacji na JBAS skorzystam z aktrakcyjniejszej funkcjonalnie oferty serwera Java EE 5, potencjalnie Apache Geronimo (chociaż w obwodzie oczekuje i GlassFish).
jlaskowski@work /cygdrive/c/projs/sandbox
$ mvn -v
Maven version: 2.0.9
Java version: 1.5.0_14
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
jlaskowski@work /cygdrive/c/projs/sandbox
$ mvn archetype:create -DgroupId=pl.jaceklaskowski.jsf.mda -DartifactId=mda-webapp
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [archetype:create] (aggregator-style)
[INFO] ------------------------------------------------------------------------
...
[INFO] OldArchetype created in dir: c:\projs\sandbox\mda-webapp
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
Uruchamiam
NetBeans IDE 6.1 RC1 i importuję projekt, aby zmodyfikować
pom.xml (plik konfiguracyjny "serce" projektu mavenowego). Wcześniej zainstalowałem netbeansową wtyczkę wspierającą projekty mavenowe (patrz
Tworzenie wtyczek Maven 2 z NetBeans IDE 6.1), więc wystarczy
Ctrl+Shift+O i wybrać katalog, który stworzyłem wcześniej ręcznie (auć, przecież mogłem to stworzyć z poziomu NB!).

Po zmianach pom.xml prezentuje się następująco:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.jaceklaskowski.jsf.mda</groupId>
<artifactId>mda-webapp</artifactId>
<version>1.0</version>
<name>Aplikacja webowa z pomocą (Andro)MDA, Maven2 i NetBeans 6.1</name>
<url>http://www.jaceklaskowski.pl</url>
<build>
<defaultGoal>compile</defaultGoal>
<plugins>
<plugin>
<groupId>org.andromda.maven.plugins</groupId>
<artifactId>andromdapp-maven-plugin</artifactId>
<version>3.2</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>andromda</id>
<name>AndroMDA Repository</name>
<url>http://team.andromda.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>andromda</id>
<name>AndroMDA Repository</name>
<url>http://team.andromda.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Wybieram
Build z menu kontekstowego projektu (zaznaczam projekt w widoku
Projects i z menu pod prawym przyciskiem myszki wybieram Build). BUILD SUCCESSFUL w oknie Output upewnia mnie, że wszystko jest jak należy.
W sekcji
Install a UML tool proponuje się skorzystanie z narzędzia UML, w którym zobrazuję mój pomysł nowej aplikacji webowej, którą następnie wyeksportuję w odpowiednim formacie zrozumiałym dla AndroMDA. Mam dostęp do wszystkich wymienionych produktów, ale do
IBM Rational Software Architect (obecnie w wersji
7.0.0.6), który wspiera
UML2/EMF jest mi najbliżej skorzystam z niego (mógłbym również skorzystać z NetBeans IDE 6.1 i jego wsparcia UMLa, ale skoro nie jest wymieniony na stronie na razie odpada).
We wskazanej gotowej aplikacji na stronie
TimeTracker Tour można znaleźć plik
readme.txt, w którym napisano:
The project located in this directory has been generated by Naresh Bhatia using the andromdapp:generate Maven plugin.Fajnie wiedzieć, że przynajmniej część mojej pracy mogę zrzucić na barki mavena. Spróbujmy dowiedzieć się więcej o tej wtyczce z pomocą
mvn help:describe (tak mógłbym wszystko wyczytać w pliku, albo na stronie, ale pomyślałem, że pochwalę się moją znajomością Maven-Fu ;-)).
jlaskowski@work ~
$ mvn help:describe -Dplugin=org.andromda.maven.plugins:andromdapp-maven-plugin:3.2
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'help'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [help:describe] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [help:describe]
[INFO] Plugin: 'org.andromda.maven.plugins:andromdapp-maven-plugin:3.2'
-----------------------------------------------
Group Id: org.andromda.maven.plugins
Artifact Id: andromdapp-maven-plugin
Version: 3.2
Goal Prefix: andromdapp
Description:
A plugin for running AndroMDA's AndroMDApp application generator
to generate Maven2 AndroMDA powered applications.
albo nawet z parametrem
-Dmedium=true, który przedstawi funkcjonalność wtyczki w okrojonej postaci (dla czytających o mocnych nerwach proponuje się opcję
-Dfull=true. Uprasza się o zapięcie pasów przez uruchomieniem polecenia ;-)).
jlaskowski@work ~
$ mvn help:describe -Dplugin=org.andromda.maven.plugins:andromdapp-maven-plugin:3.2 -Dmedium=true
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'help'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [help:describe] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [help:describe]
[INFO] Plugin: 'org.andromda.maven.plugins:andromdapp-maven-plugin:3.2'
-----------------------------------------------
Group Id: org.andromda.maven.plugins
Artifact Id: andromdapp-maven-plugin
Version: 3.2
Goal Prefix: andromdapp
Description:
A plugin for running AndroMDA's AndroMDApp application generator
to generate Maven2 AndroMDA powered applications.
Mojos:
Goal: 'clean-structure'
Description:
Removes the an AndroMDApp generated application structure.
Goal: 'generate'
Description:
AndroMDA application generator Mojo.
Goal: 'build'
Description:
A Mojo used for executing the build goals from the top level project.
Goal: 'deploy'
Description:
Provides the deployment of applications to a given directory.
Goal: 'eclipse'
Description:
Writes the necessary .classpath and .project files for a new eclipse application.
Goal: 'maven'
Description:
Allows the execution of maven from a given project (searches for nested pom.xml files and executes Maven)
Goal: 'schema'
Description:
Provides the ability to drop database schemas.
Goal: 'instrument-scripts'
Description:
Allows for the {@link ScriptClassGenerator} mojo to be invoked. on one or more given classes.
Goal: 'undeploy'
Description:
Provides the undeployment of applications from a given directory.
Importuję aplikację
timetracker-completed do NB i wykonuję
Clean and Build (przecież nie będę tego robił z linii poleceń, kiedy dotykam MDA, nieprawdaż?). Jedna uwaga, projekt TimeTracker po zaimportowaniu zostanie oznaczony przez NB jako posiadający błędy i wykonanie budowania spowoduje rozwiązanie problemów (niedostępności bibliotek w lokalnym repozytorium mavena). Trochę to trwa zanim aplikacja zostanie zbudowana, aż po około 2-3 minutach pojawia się [ERROR]BUILD FAILURE. Hmm, czyżbym tracił cierpliwość? Próbuję innymi technikami - z menu kontekstowego projektu TimeTracker wybieram
Open Required Projects (wcześniej jedynie otworzyłem projekt główny) i sprawdzam klasę
UserVOComparator (projekt
TimeTracker Common (jar)). Najwyraźniej nie ma klasy UserVO w projekcie. Wykonanie polecenia
jlaskowski@work /cygdrive/c/temp/timetracker-completed
$ find . -name UserVO.java -print
nie napawa optymizmem. Może ten plik jest tworzony dynamicznie podczas budowania? Zgodnie z dokumentacją powinienem
mvn install w katalogu głównym aplikacji. Niech będzie.
jlaskowski@work /cygdrive/c/temp/timetracker-completed
$ mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An invalid artifact was detected.
This artifact might be in your project's POM, or it might have been included transitively
during the resolution process. Here is the information we do have for
o GroupID: org.andromda.timetracker
o ArtifactID: timetracker-common
o Version: <<< MISSING >>>
o Type: jar
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.artifact.InvalidArtifactRTException: For artifact {org.andromda.timetracker:timetracker-common:null:jar}:
The version cannot be empty.
at org.apache.maven.artifact.DefaultArtifact.validateIdentity(DefaultArtifact.java:147)
at org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java:122)
at org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(DefaultArtifactFactory.java:158)
at org.apache.maven.artifact.factory.DefaultArtifactFactory.createDependencyArtifact(DefaultArtifactFactory.java:58)
at org.apache.maven.project.DefaultMavenProjectBuilder.createManagedVersionMap(DefaultMavenProjectBuilder.java:452)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:912)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:506)
at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:198)
at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:583)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:461)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:534)
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:365)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:292)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Pięknie! Napawa optymizmem do dalszej ewaluacji, co?
Kończę rozdział i po chwili jestem w
Starter App. Zamiast jednak tworzyć aplikację z linii poleceń, skorzystam z NB.
Ctrl+Shift+N i z kategorii
Maven wybieram
Maven Project. Wciskam przycisk
Add... gdzie podaję dane wtyczki, którą wykorzystam do tworzenia aplikacji.

Jak się okazuje takie podejście nie przejdzie, gdyż NB zakończy pracę z:
[ERROR]BUILD ERROR
------------------------------------------------------------------------
Error creating from archetype
Embedded error: The META-INF/maven/archetype.xml descriptor cannot be found.
Wracam na linię poleceń. Już będę grzeczny.
jlaskowski@work /cygdrive/c/projs/sandbox
$ mvn org.andromda.maven.plugins:andromdapp-maven-plugin:3.2:generate
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [org.andromda.maven.plugins:andromdapp-maven-plugin:3.2:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [andromdapp:generate]
log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester).
log4j:WARN Please initialize the log4j system properly.
INFO [AndroMDA] discovered andromdapp type --> 'j2ee'
INFO [AndroMDA] discovered andromdapp type --> 'richclient'
Please choose the type of application to generate [j2ee, richclient]
j2ee
Please enter the location in which your new application will be created (i.e. f:/java/development):
c:/projs/sandbox
Please enter your first and last name (i.e. Chad Brandon):
Jacek Laskowski
Which kind of modeling tool will you use? [uml1.4, uml2, emf-uml2]:
emf-uml2
Please enter the name of your J2EE project (i.e. Animal Quiz):
Powitanie
Please enter an id for your J2EE project (i.e. animalquiz):
mda-powitanie
Please enter a version for your project (i.e. 1.0-SNAPSHOT):
1.0
Please enter the root package name for your J2EE project (i.e. org.andromda.samples.animalquiz):
pl.jaceklaskowski.powitanie
Would you like an EAR or standalone WAR? [ear, war]:
ear
Please enter the type of transactional/persistence cartridge to use [hibernate, ejb, ejb3, spring, none]:
ejb3
Please enter the database backend for the persistence layer
[hypersonic, mysql, oracle, db2, informix, mssql, pointbase, postgres, sybase, sabdb, progress, derby]:
derby
Will your project need workflow engine capabilities? (it uses jBPM and Hibernate3)? [yes, no]:
no
Will your project have a web user interface? [yes, no]:
yes
Would you like your web user interface to use JSF or Struts? [jsf, struts]:
jsf
Would you like to use Facelets or JSP as your view type for JSF? [facelets, jsp]:
facelets
Would you like to use the JBoss Seam application framework? [yes, no]:
yes
Would you like to be able to expose your services as web services? [yes, no]:
yes
Would you like to use the JSR181 (webservice defined by annotations) EJB3 cartridge specific implementation? [yes, no]:
yes
-------------------------------------------------------------------------------------
G e n e r a t i n g A n d r o M D A P o w e r e d A p p l i c a t i o n
-------------------------------------------------------------------------------------
Output: 'file:/c:/projs/sandbox/mda-powitanie/app/src/main/application/META-INF/jboss-app.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/app/src/main/config/mda-powitanie-ds.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/app/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/core/target/classes/META-INF/ejb-jar.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/core/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/readme.txt'
Output: 'file:/c:/projs/sandbox/mda-powitanie/common/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/mda/src/main/config/mappings/WebMergeMappings.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/mda/src/main/config/andromda.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/mda/src/main/uml/mda-powitanie.uml2'
Output: 'file:/c:/projs/sandbox/mda-powitanie/mda/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/web/src/main/properties/messages.properties'
Output: 'file:/c:/projs/sandbox/mda-powitanie/web/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/web/target/mda-powitanie-web-1.0/WEB-INF/web.xml'
-------------------------------------------------------------------------------------
New application generated to --> 'file:/c:/projs/sandbox/mda-powitanie/'
Instructions for your new application --> 'file:/c:/projs/sandbox/mda-powitanie/readme.txt'
-------------------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
Otwieram projekt
mda-powitanie i projekty zależne w NB (Ctrl+Shift+O). Teraz jest czysto (z ostrzeżeniami, których udam, że nie zauważam).

Jak w poprzednim projekcie w katalogu głównym znajduje się plik
readme.txt (widoczny w NB w oknie
Files, gdyż
Projects ukrywa pliki, których nierozpoznaje).
Wykonuję
mvn install w wydaniu NB, tj.
Clean and Build. W pobieranych zależnościach, podczas budowania, pojawiają się
myfaces-impl-1.1.1,
tomahawk-1.1.1, aż kończę z
------------------------------------------------------------------------
[ERROR]BUILD ERROR
------------------------------------------------------------------------
Failed to resolve artifact.
Missing:
----------
1) org.andromda.profiles.uml14:andromda-profile-seam:xml.zip:1.0-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.andromda.profiles.uml14 -DartifactId=andromda-profile-seam \
-Dversion=1.0-SNAPSHOT -Dpackaging=xml.zip -Dfile=/path/to/file
Path to dependency:
1) pl.jaceklaskowski.powitanie:mda-powitanie-mda:pom:1.0
2) org.andromda.profiles.uml14:andromda-profile-seam:xml.zip:1.0-SNAPSHOT
----------
1 required artifact is missing.
for artifact:
pl.jaceklaskowski.powitanie:mda-powitanie-mda:pom:1.0
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
andromda (http://team.andromda.org/maven2)
Ech, znowu kłopoty. Kasuję projekt i zaczynam jeszcze raz, tyle że bez Seama i Web Services (po tylu problemach stałem się mniej wymagający).
jlaskowski@work /cygdrive/c/projs/sandbox
$ mvn org.andromda.maven.plugins:andromdapp-maven-plugin:3.2:generate
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [org.andromda.maven.plugins:andromdapp-maven-plugin:3.2:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [andromdapp:generate]
log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester).
log4j:WARN Please initialize the log4j system properly.
INFO [AndroMDA] discovered andromdapp type --> 'j2ee'
INFO [AndroMDA] discovered andromdapp type --> 'richclient'
Please choose the type of application to generate [j2ee, richclient]
j2ee
Please enter the location in which your new application will be created (i.e. f:/java/development):
c:/projs/sandbox
Please enter your first and last name (i.e. Chad Brandon):
Jacek Laskowski
Which kind of modeling tool will you use? [uml1.4, uml2, emf-uml2]:
emf-uml2
Please enter the name of your J2EE project (i.e. Animal Quiz):
Powitanie
Please enter an id for your J2EE project (i.e. animalquiz):
mda-powitanie
Please enter a version for your project (i.e. 1.0-SNAPSHOT):
1.0
Please enter the root package name for your J2EE project (i.e. org.andromda.samples.animalquiz):
pl.jaceklaskowski.powitanie
Would you like an EAR or standalone WAR? [ear, war]:
ear
Please enter the type of transactional/persistence cartridge to use [hibernate, ejb, ejb3, spring, none]:
ejb3
Please enter the database backend for the persistence layer
[hypersonic, mysql, oracle, db2, informix, mssql, pointbase, postgres, sybase, sabdb, progress, derb
derby
Will your project need workflow engine capabilities? (it uses jBPM and Hibernate3)? [yes, no]:
no
Will your project have a web user interface? [yes, no]:
yes
Would you like your web user interface to use JSF or Struts? [jsf, struts]:
jsf
Would you like to use Facelets or JSP as your view type for JSF? [facelets, jsp]:
facelets
Would you like to use the JBoss Seam application framework? [yes, no]:
no
Would you like to be able to expose your services as web services? [yes, no]:
no
-------------------------------------------------------------------------------------
G e n e r a t i n g A n d r o M D A P o w e r e d A p p l i c a t i o n
-------------------------------------------------------------------------------------
Output: 'file:/c:/projs/sandbox/mda-powitanie/app/src/main/application/META-INF/jboss-app.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/app/src/main/config/mda-powitanie-ds.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/app/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/core/target/classes/META-INF/ejb-jar.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/core/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/readme.txt'
Output: 'file:/c:/projs/sandbox/mda-powitanie/common/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/mda/src/main/config/mappings/WebMergeMappings.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/mda/src/main/config/andromda.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/mda/src/main/uml/mda-powitanie.uml2'
Output: 'file:/c:/projs/sandbox/mda-powitanie/mda/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/web/src/main/properties/messages.properties'
Output: 'file:/c:/projs/sandbox/mda-powitanie/web/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/web/target/mda-powitanie-web-1.0/WEB-INF/web.xml'
-------------------------------------------------------------------------------------
New application generated to --> 'file:/c:/projs/sandbox/mda-powitanie/'
Instructions for your new application --> 'file:/c:/projs/sandbox/mda-powitanie/readme.txt'
-------------------------------------------------------------------------------------
Ponownie otwarcie projektu w NB i Clean and Build, które kończy się:
INFO [AndroMDA] completed model processing --> TIME: 10.688[s], RESOURCES WRITTEN: 118
[andromdapp:eclipse {execution: default}]
Project file written --> 'C:\projs\sandbox\mda-powitanie\.project'
found project pl.jaceklaskowski.powitanie:mda-powitanie-common:jar:1.0
found project pl.jaceklaskowski.powitanie:mda-powitanie-core:ejb:1.0
found project pl.jaceklaskowski.powitanie:mda-powitanie-web:war:1.0
------------------------------------------------------------------------
[ERROR]BUILD ERROR
------------------------------------------------------------------------
Error creating eclipse configuration
Embedded error: Unable to download the artifact from any repository
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.jboss -DartifactId=jboss-remoting \
-Dversion=4.0.4-GA -Dpackaging=jar -Dfile=/path/to/file
org.jboss:jboss-remoting:jar:4.0.4-GA
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
andromda (http://team.andromda.org/maven2)
co jednak mnie nie przeraża, bo sam projekt został zbudowany, a jedynie projekt eclipsowy się nie utworzył.
..po chwili...No dobrze, dobrze - zajmę się i tym (co, jak się zaraz okaże, nie było właściwą decyzją). Do głównego pom.xml projektu dodaję
<repository>
<id>jboss.com</id>
<name>JBoss Repository</name>
<url>http://repository.jboss.com/maven2/</url>
</repository>
i ponownie podchodzę do
Clean and Build. Znowu błąd. Dziwne, ale tego
jboss-remoting nie ma w repozytorium jboss.com. Jest jednak w wersji
4.0.5-GA w
repozytorium andromda (http://team.andromda.org/maven2). Wniosek: wtyczka
andromdapp-maven-plugin w wersji
3.2 tworzy projekt z przestarzałymi (i niedostępnymi) zależnościami. Na
stronie wtyczki andromdapp-maven-plugin data ostatniej publikacji to 01 Mar 2008 11:53 CET, jednakże jest to dla wersji 3.3-SNAPSHOT. Nie ma wielkiego wyboru jak popróbować jej.
Na szczęście projekt AndroMDA przewidział taką sytuację, że chciałbym skorzystać z wtyczki poza projektem, gdzie w pom.xml mógłbym zdefiniować zależność i udostępnił gotowy plik zip z koniecznymi artefaktami mavenowymi do rozpakowania w lokalnym repozytorium mavena.
jlaskowski@work /cygdrive/c/projs/sandbox
$ cd c:/.m2
jlaskowski@work /cygdrive/c/.m2
$ wget -c \
http://team.andromda.org/maven2/org/andromda/maven/plugins/\
andromdapp-maven-plugin/3.3-SNAPSHOT/andromdapp-maven-plugin-install-3.3-SNAPSHOT.zip
...
12:13:49 (153.83 KB/s) - `andromdapp-maven-plugin-install-3.3-SNAPSHOT.zip' saved [80881/80881]
jlaskowski@work /cygdrive/c/.m2
$ jar -xvf andromdapp-maven-plugin-install-3.3-SNAPSHOT.zip
created: org/
created: org/andromda/
created: org/andromda/maven/
created: org/andromda/maven/plugins/
created: org/andromda/maven/plugins/andromdapp-maven-plugin/
created: org/andromda/maven/plugins/andromdapp-maven-plugin/3.3-SNAPSHOT/
inflated: org/andromda/maven/plugins/andromdapp-maven-plugin/3.3-SNAPSHOT/andromdapp-maven-plugin-3.3-SNAPSHOT.jar
inflated: org/andromda/maven/plugins/andromdapp-maven-plugin/3.3-SNAPSHOT/andromdapp-maven-plugin-3.3-SNAPSHOT.pom
inflated: org/andromda/maven/plugins/andromdapp-maven-plugin/maven-metadata-local.xml
Gotowe! Znowu podchodzę do stworzenia projektu z wtyczką andromdapp-maven-plugin w wersji 3.3-SNAPSHOT.
jlaskowski@work /cygdrive/c/projs/sandbox
$ mvn org.andromda.maven.plugins:andromdapp-maven-plugin:3.3-SNAPSHOT:generate
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
GroupId: org.andromda.maven.plugins
ArtifactId: andromda-maven-plugins
Version: 3.3-SNAPSHOT
Reason: Unable to download the artifact from any repository
org.andromda.maven.plugins:andromda-maven-plugins:pom:3.3-SNAPSHOT
from the specified remote repositories:
ibiblio.org (http://repo1.maven.org/maven2)
Tego już za wiele! Wracam do wtyczki w wersji 3.2 i rezygnuję z EJB3, co powinno znieść wymaganie odnośnie jakichkolwiek zależności jbossowych.
jlaskowski@work /cygdrive/c/projs/sandbox
$ mvn org.andromda.maven.plugins:andromdapp-maven-plugin:3.2:generate
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [org.andromda.maven.plugins:andromdapp-maven-plugin:3.2:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [andromdapp:generate]
log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester).
log4j:WARN Please initialize the log4j system properly.
INFO [AndroMDA] discovered andromdapp type --> 'j2ee'
INFO [AndroMDA] discovered andromdapp type --> 'richclient'
Please choose the type of application to generate [j2ee, richclient]
j2ee
Please enter the location in which your new application will be created (i.e. f:/java/development):
c:/projs/sandbox
Please enter your first and last name (i.e. Chad Brandon):
Jacek Laskowski
Which kind of modeling tool will you use? [uml1.4, uml2, emf-uml2]:
emf-uml2
Please enter the name of your J2EE project (i.e. Animal Quiz):
Powitanie
Please enter an id for your J2EE project (i.e. animalquiz):
mda-powitanie
Please enter a version for your project (i.e. 1.0-SNAPSHOT):
1.0
Please enter the root package name for your J2EE project (i.e. org.andromda.samples.animalquiz):
pl.jaceklaskowski.powitanie
Would you like an EAR or standalone WAR? [ear, war]:
ear
Please enter the type of transactional/persistence cartridge to use [hibernate, ejb, ejb3, spring, none]:
none
Will your project need workflow engine capabilities? (it uses jBPM and Hibernate3)? [yes, no]:
no
Will your project have a web user interface? [yes, no]:
yes
Would you like your web user interface to use JSF or Struts? [jsf, struts]:
jsf
Would you like to use Facelets or JSP as your view type for JSF? [facelets, jsp]:
jsp
Would you like to be able to expose your services as web services? [yes, no]:
no
-------------------------------------------------------------------------------------
G e n e r a t i n g A n d r o M D A P o w e r e d A p p l i c a t i o n
-------------------------------------------------------------------------------------
Output: 'file:/c:/projs/sandbox/mda-powitanie/app/src/main/application/META-INF/jboss-app.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/app/src/main/config/mda-powitanie-ds.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/app/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/readme.txt'
Output: 'file:/c:/projs/sandbox/mda-powitanie/common/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/mda/src/main/config/mappings/WebMergeMappings.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/mda/src/main/config/andromda.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/mda/src/main/uml/mda-powitanie.uml2'
Output: 'file:/c:/projs/sandbox/mda-powitanie/mda/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/web/src/main/properties/messages.properties'
Output: 'file:/c:/projs/sandbox/mda-powitanie/web/pom.xml'
Output: 'file:/c:/projs/sandbox/mda-powitanie/web/target/mda-powitanie-web-1.0/WEB-INF/web.xml'
-------------------------------------------------------------------------------------
New application generated to --> 'file:/c:/projs/sandbox/mda-powitanie/'
Instructions for your new application --> 'file:/c:/projs/sandbox/mda-powitanie/readme.txt'
-------------------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
Ponownie Clean and Build w NB.
------------------------------------------------------------------------
[ERROR]BUILD ERROR
------------------------------------------------------------------------
Failed to resolve artifact.
Missing:
----------
1) org.andromda.cartridges:andromda-jsf-cartridge-components:jar:unknown
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.andromda.cartridges -DartifactId=andromda-jsf-cartridge-components \
-Dversion=unknown -Dpackaging=jar -Dfile=/path/to/file
Path to dependency:
1) pl.jaceklaskowski.powitanie:mda-powitanie-web:war:1.0
2) org.andromda.cartridges:andromda-jsf-cartridge-components:jar:unknown
2) oracle.adf.view.faces:adf-faces-api:jar:unknown
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=oracle.adf.view.faces -DartifactId=adf-faces-api \
-Dversion=unknown -Dpackaging=jar -Dfile=/path/to/file
Path to dependency:
1) pl.jaceklaskowski.powitanie:mda-powitanie-web:war:1.0
2) oracle.adf.view.faces:adf-faces-api:jar:unknown
3) org.apache.myfaces:tomahawk:jar:unknown
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.apache.myfaces -DartifactId=tomahawk \
-Dversion=unknown -Dpackaging=jar -Dfile=/path/to/file
Path to dependency:
1) pl.jaceklaskowski.powitanie:mda-powitanie-web:war:1.0
2) org.apache.myfaces:tomahawk:jar:unknown
4) org.apache.myfaces:myfaces-api:jar:unknown
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.apache.myfaces -DartifactId=myfaces-api \
-Dversion=unknown -Dpackaging=jar -Dfile=/path/to/file
Path to dependency:
1) pl.jaceklaskowski.powitanie:mda-powitanie-web:war:1.0
2) org.apache.myfaces:myfaces-api:jar:unknown
----------
4 required artifacts are missing.
for artifact:
pl.jaceklaskowski.powitanie:mda-powitanie-web:war:1.0
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
andromda (http://team.andromda.org/maven2)
Teraz jest jeszcze gorzej. Na dzisiaj koniec tego ewaluowania AndroMDA. Teraz już wiem, dlaczego tak niewielu korzysta z MDA. Fajne w założeniach, ale po prostu nie działa (albo ja coś pokręciłem i zamiast dać się prowadzić za rękę to przekombinowałem). Może ktoś ma jakieś sugestie gdzie, co i jak należałoby wykonać, aby skorzystać jednak z AndroMDA? Jakieś doświadczenia z narzędziem, albo jego konkurentami mile widziane.
I pytanie konkursowe:
Co oznacza skrót MDA?- "Moja Droga Agatko!" (szczęśliwi, którzy mogą tak tytułować listy do swej ukochanej)
- Mam Dość, Ale się nie poddaję
- Model-Driven Architecture
- ManDarynA gwarowo
Nagród nie ma.