2012-01-25

Install Maven, JBoss 7.0.2 and setup a JEE 6 project



1. Install JBoss 7.0.2



1.1 Download and extract JBoss 7.0.2

1.2 Linux only: in a command shell change to the JBoss directory(.../jboss-as-7.0.2.Final/bin) and make standalone.sh executable with: chmod 755 standalone.sh

1.3 Start JBoss in .../jboss-as-7.0.2.Final/bin with ./standalone.sh in Linux or standalone.bat in Windows. You shuold see something like:

16:20:24,569 INFO [org.jboss.as] (Controller Boot Thread) JBoss AS 7.0.2.Final "Arc" started in 1783ms - Started 93 of 148 services (55 services are passive or on-demand)

Open the URL http://localhost:8080/ in your browser. The welcome page of JBoss should be seen.


2. Setup Maven



Maven is used for building and managing Java-based projects. You will find more about installing Maven at maven.apache.org

2.1 Download Maven 3 or a later release and extract it to a path of your choise

2.2 Open another shell and set the enviroment variable M2_HOME pointing to your Maven directory, for example

within Linux:

In a command terminal, add the M2_HOME with export M2_HOME=/Users/myUser/Development/apache-maven-3.0.3 Also add it to your path: export PATH=$M2_HOME/bin:$PATH

within Windows:

Hit the WinKey+Pause, select "Advanced" M2_HOME=C:/myUser/Development/apache-maven-3.0.3 Add /Users/myUser/Development/apache-maven-3.0.3/bin to your user variable

2.3 In the command shell try maven -version, you should see something like: Apache Maven 3.0.3

2.4 Configure the JBoss repository(more details can be found at the JBoss-Wiki)

Add the following profil under in ../apache-maven-3.0.3/conf/settings.xml

    
       jboss-public-repository
       
          
             jboss-public-repository
             !false
          
       
       
          
             jboss-public-repository-group
             JBoss Public Maven Repository Group
             http://repository.jboss.org/nexus/content/groups/public
             
                true
                never
             
             
                false
                never
             
          
       
       
          
             jboss-public-repository-group
             JBoss Public Maven Repository Group
             http://repository.jboss.org/nexus/content/groups/public
             
                true
                never
             
             
                false
                never
             
          
       
    


3. Create a Maven JEE 6 project



3.1 In the command shell go to your favourite project folder, i.e. /Users/myUser/Documents/workspace

3.2 run: mvn archetype:generate -DgroupId=org.example -DartifactId=JEE6Project -DpackageName=org. -Dversion=0.0.1-SNAPSHOT -Dfilter=jboss-javaee6-webapp-archetype

3.3 Type 1 and hit return. Hit it again until Maven has finished

3.4 You should see a new folder "JEE6Project".

3.5 In your project directory (.../JEE6Project/ where the pom.xml is stored) run: mvn clean install

3.6 Now copy the new war file to the JBoss deploy directory, i.e. cp .../JEE6Project/target/JEE6Project.war ~/Documents/workspace/JEE6Project (This can also be done with Maven, but needs a bit more configuration)

In your browser type http://localhost/JEE6Project/, the final result should look like this:



4. Create a JEE6Project with Eclipse



At the JBoss website you can find a good documentation and also a video tutorial how to create a JEE 6 project. Before you only have to install Eclipse and JBossTools.

4.1 Start Eclipse(I use Eclipse Indigo Service Release 1)

4.2 In the menu choose Help > Install new Software > Add...

4.3 Enter a name like "JBossTools" and add the URL http://download.jboss.org/jbosstools/updates/development/indigo/. Look at the JBossTools documentation for the actual URL.

4.4 Select everything and hit next

4.5 Accept the licences and go on till the installer ends

4.6 Follow the video tutorial here

Keine Kommentare:

Kommentar veröffentlichen