如何更改从mvn eclipse:eclipse创建的.project中的项目名称? [英] How to change project name in .project created from mvn eclipse:eclipse?

查看:110
本文介绍了如何更改从mvn eclipse:eclipse创建的.project中的项目名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我pom.xml的内容

Here is the content of my pom.xml

<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>
    <url>http://maven.apache.org</url>

    <name>SomeProject</name>

    <groupId>com.test.te</groupId>
    <artifactId>testjar</artifactId>
    <version>1.1.6</version>
    <packaging>jar</packaging>

    <dependencies>
    ....
    ....
    </dependencies>
    <build>        
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

我正在通过执行以下命令来创建eclipse的.project文件.

I am creating eclipse's .project file by executing the below command.

mvn eclipse:clean
mvn eclipse:eclipse

这是我的.project文件的内容

Here is the content of my .project file

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>testjar</name>
    <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

它正在创建项目名称testjar而不是SomeProject.

It is creating the project name testjar instead of SomeProject.

如何以行家方式进行更改?

How to change it in maven way?

推荐答案

添加了另一个支持此功能的插件,并指定了项目名称

Added another plugin to support this, and gave project name

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <configuration>
            <projectNameTemplate>SomeProject</projectNameTemplate>
        </configuration>
    </plugin>

这篇关于如何更改从mvn eclipse:eclipse创建的.project中的项目名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆