tags:

views:

22

answers:

0

Hi, guys

I ran into such a situation, when packaging a project using maven, I'd like both the source package and the binary package, and they have the same manifest.mf file. Then I have to write the same entry in both plugin configuration of maven-source-plugin and maven-jar-plugin, like this:

        <plugins>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Artifiact>${project.name}</Artifiact>
                            <Version>${project.version}</Version>
                            <Vendor>${project.organization.name}</Vendor>
                            <Built-By>Shiva Wu</Built-By>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                        <manifestEntries>
                            <Artifiact>${project.name}</Artifiact>
                            <Version>${project.version}</Version>
                            <Vendor>${project.organization.name}</Vendor>
                            <Built-By>Shiva Wu</Built-By>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins> 
    


It's really not convenient to modify both of them while changing settings. Is there a better way to resolve this?

Thanks:)