1

I am complete new to IntellijIdea and i am looking for some step-by-step process to set up a basic project.

My project depends on Maven + Jaxb classes so i need a Maven project so that when i compile this project, the JAXB Objects are generated by Maven plugins. Now i started like this

  1. I created a blank project say MaJa project
  2. Added Maven Module to it
  3. Added following settings in POM.XML
 <?xml version="1.0" encoding="UTF-8"?>
 <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/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>MaJa</groupId>
    <artifactId>MaJa</artifactId>
    <version>1.0</version>

    <dependencies>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <schemaDirectory>${basedir}/src/main/resource/api/MaJa</schemaDirectory>
                    <packageName>com.rimt.shopping.api.web.ws.v1.model</packageName>
                    <outputDirectory>${build.directory}</outputDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
  1. First of all, is it right settings ?

  2. I tried clicking on Make/Compile 'MaJa' from Project > Right Click Menu and it didn't do anything.

I will be looking forward to yoru replies.

4

1 に答える 1

2

1)をクリックしないでください。Make/Compile 'MaJa'
ここでMavenビルドライフサイクルフェーズの1つを選択する必要があります(少なくともCompile)。
2)設定でMavenへのパスを設定します。3)アーティファクト
のバージョンを追加するjaxb-api

ここに画像の説明を入力してください

shiporder.xsdディレクトリに追加する/src/main/resource/api/MaJaと、Javaクラスが適切に生成されました

[jaxb2:xjc]
Generating source...
parsing a schema...
compiling a schema...
com\rim\shopping\api\web\ws\v1\model\ObjectFactory.java
com\rim\shopping\api\web\ws\v1\model\Shiporder.java
于 2012-09-26T21:10:38.683 に答える