My favorites | Sign in
Project Logo
                
Search
for
Updated Nov 22, 2008 by trung.nkien
Labels: Phase-Deploy, Phase-Implementation, Featured
GettingStarted  
  1. Build from the code
    1. Install the archetype in your repository
    2. mvn clean install
    3. Create a project using blazeds-spring archetype from the local archetype repository
    4. mvn archetype:generate -DartifactId=<your artifactId> -DarchetypeCatalog=local
  2. OR Create a project from the remote repository
  3. mvn archetype:generate -DartifactId=<your artifactId> -DarchetypeCatalog=http://maven-blazeds-spring-archetype.googlecode.com/svn/maven2/
  4. Initial setup
  5. mvn clean install-DtemplateURI=folder:html-template
    The reason we must have -DtemplateURI when doing mvn install at master-pom level is the default templateURI is folder:../html-template which is relative to the app-flex folder, while at master-pom level, the default value is no longer valid
  6. Import project into Eclipse
    • Your Eclipse must have m2eclipse plugin and WTP
    • Using File->Import->Existing project into workspace
    • After importing, some of the errors may occur:
      1. JRE version. Please change it accordingly in project properties
      2. m2eclipse is not updating the dependencies, right click on the project, and choose Maven2->Update Dependencies
  7. Create Tomcat container to host the application
    • You must have Apache Tomcat installed in your local machine
    • Create a new server and add your web project to tomcat. So in Server View, it would be similar to this
    • If successful, you must see the whole web application folder in the Apache Tomcat deployment folder (red rectangle), relative to your workspace folder
  8. Debug application
    • You can debug Java code by running tomcat under Debug mode
    • Or you can debug Flex Application by running Flex Application in Debug mode

Comment by bhaskarvk, Nov 17, 2008

Good job, But the archetype needs more work. For starters I could get it working only when version is set to "1.0" and the artifactID is set to "app". Any other values for these 2 fields results in a non working application, which I suspect is due to hard-coding "1.0" and "app" in certain places.

Comment by martin.a.villafane, Aug 18, 2009

Ok, but how can I try the web application? If I open a browser and type http://localhost:8080/flexTest-web (in my case), it opens the page index.jsp and says "Hello world" but no flex code is run. Thanks

Comment by du.xiaoming86, Sep 25, 2009

The spring module "spring-flex" is released. Is there a plan to make use of this new module in maven-blazeds-spring-archetype? Maybe we can create another archetype ?

http://www.springsource.org/node/1998

Comment by khoivu, Oct 15, 2009

Great work. It work great for me. I had to edit app-web/pom.xml and app-flex/pom.xml to minor tweak (these are really non-issues)

app-web/pom.xml: change the final-name node to be my artifact-id instead of app-web app-flex/pom.xml: change to make the context root to be my artifact-id instead of "/artifact-id-web.

I also change the versions of flex-sdk and flexmojos to the latest one.

Thanks for your great work.

Comment by khoivu, Oct 15, 2009

I got the same problem as martin.a.villafane encountered. By looking a round I found that your archetype is still using maven plugin info.flex-mojos which does not execute the html-wrapper as expected (or I could not figure it out myself). And it seems that the maven plugin info.flex.mojos is now renamed to org.sonatype.flexmojos. Here are what I tweaked to make thing work (almost works)

  • First I removed html-template
  • Copy all template files from $(FLASH4_SDK_HOME)/templates/swfobjects to app-web/WEB-INF Since I am using flash builder 4 sdk. For people who is still working on flex 3, you can move all files under html-template to app-web/WEB-INF.
  • Edit app-web/WEB-INF/web.xml and change the welcome file to be index.html instead of index.jsp
  • Rename app-web/WEB-INF/index.template.html to app-web/WEB-INF/index.html
  • Then edit pom files to use org.sonatype.flexmojos plugin instead since org.sonatype.flexmojos assumes the html-template is under app-web/WEB-INF folder.
Comment by khoivu, Oct 15, 2009

Here is my change in app-web/pom.xml

	<build>
		<finalName>yomogi</finalName>
		<plugins>
			<plugin>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>unpack-config</id>
						<goals>
							<goal>unpack-dependencies</goal>
						</goals>
						<phase>generate-resources</phase>
						<configuration>
							<outputDirectory>
								${project.build.directory}/${project.build.finalName}/WEB-INF/flex
							</outputDirectory>
							<includeArtifacIds>
								yomogi-flex-config
							</includeArtifacIds>
							<includeGroupIds>
								${project.groupId}
							</includeGroupIds>
							<includeClassifiers>
								resources
							</includeClassifiers>
							<excludeTransitive>true</excludeTransitive>
							<excludeTypes>jar,swf</excludeTypes>
						</configuration>
					</execution>
				</executions>
			</plugin>
			
			<plugin>
		        <groupId>org.sonatype.flexmojos</groupId>
		        <artifactId>flexmojos-maven-plugin</artifactId>
		        <version>${flexmojos.version}</version>
		        <executions>
		          <execution>
		            <goals>
					  <goal>wrapper</goal>
					  <goal>copy-flex-resources</goal>
		            </goals>
		          </execution>
		        </executions>

				<configuration>
				  <wrapperArtifact>
					<groupId>${project.groupId}</groupId>
					<artifactId>yomogi-flex</artifactId>

					<!-- Optional, as a swf dependency with the same id will be
									 searched for if not defined. -->
					<version>1.0-SNAPSHOT</version>
				  </wrapperArtifact>

				  <templateInclusions>
					<String>**/*.jsp</String>
					<String>**/*.html</String>
					<String>WEB-INF/**/*</String>
					<String>history/**</String>
					<String>playerProductInstall.swf</String>
				  </templateInclusions>

				  <templateExclusions>
					<String>**/*.txt</String>
					<String>**/*.bak</String>
				  </templateExclusions>
				</configuration>

	       </plugin>
		   
			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>maven-jetty-plugin</artifactId>
				<version>${maven.jetty.plugin.version}</version>
				<configuration>
					<webAppSourceDirectory>
						${project.build.directory}/${project.build.finalName}
					</webAppSourceDirectory>
				</configuration>
			</plugin>
		</plugins>
	</build>

and here is my change in web-flex/pom.xml

		<plugins>
	      <plugin>
	        <groupId>org.sonatype.flexmojos</groupId>
	        <artifactId>flexmojos-maven-plugin</artifactId>
	        <version>${flexmojos.version}</version>
	        <extensions>true</extensions>
	        <configuration>
	          <contextRoot>yomogi</contextRoot>
	          <targetPlayer>10.0.0</targetPlayer>
	          <locales>
	            <locale>en_US</locale>
	          </locales>
	        </configuration>
	        <dependencies>
	          <dependency>
	            <groupId>com.adobe.flex</groupId>
	            <artifactId>compiler</artifactId>
	            <version>${flex.sdk.version}</version>
	            <type>pom</type>
	          </dependency>
	        </dependencies>
	      </plugin>

			  <plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
				  <execution>
					<id>unpack-config</id>
					<goals>
					  <goal>unpack-dependencies</goal>
					</goals>
					<phase>generate-resources</phase>
					<configuration>
					  <outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
					  <includeArtifactIds>yomogi-flex-config</includeArtifactIds>
					  <includeGroupIds>${project.groupId}</includeGroupIds>
					  <excludeTransitive>true</excludeTransitive>
					</configuration>
				  </execution>
				</executions>
			  </plugin>

		</plugins>
Comment by eric.meallier, Nov 05, 2009

After an update on flex-mojos version (2.0M8 no more available), it works perfectly. Thank you !


Sign in to add a comment
Hosted by Google Code