在使用m2e生命周期映射时,如何从Eclipse中的maven插件获得输出?

时间:2017-07-04 11:36:25

标签: eclipse maven m2e exec-maven-plugin

我无法从Eclipse Maven控制台中输出自定义java类(SchemaGenerator)的任何输出。有没有办法做到这一点?该类当前使用sys out和sys err,当从命令行使用mvn时,它出现在输出中。

<build>

    <!-- allow m2e to trigger the exec-maven-plugin -->
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>exec-maven-plugin</artifactId>
                                    <versionRange>[1,)</versionRange>
                                    <goals>
                                        <goal>java</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute>
                                        <runOnConfiguration>true</runOnConfiguration>
                                        <runOnIncremental>true</runOnIncremental>
                                    </execute>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

    <plugins>
        <!-- custom build step -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.6.0</version>
            <executions>
                <execution>
                    <id>SchemaGenerator</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>java</goal>
                    </goals>
                    <configuration>
                        <includePluginDependencies>true</includePluginDependencies>
                        <includeProjectDependencies>false</includeProjectDependencies>
                        <mainClass>jit.SchemaGenerator</mainClass>
                        <arguments>
                            <argument>${project.build.outputDirectory}</argument>
                            <argument>schema.xml</argument>
                        </arguments>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>jit</groupId>
                    <artifactId>schema-generator</artifactId>
                    <version>0.0.1</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>

</build>

0 个答案:

没有答案