How to change project name in .project created from mvn eclipse:eclipse?

守給你的承諾、 提交于 2019-12-11 13:20:54

问题


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>

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

mvn eclipse:clean
mvn eclipse:eclipse

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>

It is creating the project name testjar instead of SomeProject.

How to change it in maven way?


回答1:


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>


来源:https://stackoverflow.com/questions/33410404/how-to-change-project-name-in-project-created-from-mvn-eclipseeclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!