You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "dinwath (JIRA)" <ji...@apache.org> on 2017/05/18 16:49:04 UTC

[jira] [Comment Edited] (MDEP-541) Allow for a space character as a pathSeparator in dependency:build-classpath

    [ https://issues.apache.org/jira/browse/MDEP-541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16016050#comment-16016050 ] 

dinwath edited comment on MDEP-541 at 5/18/17 4:48 PM:
-------------------------------------------------------

Another use Case: I'm dealing with an application that uses ATG Dynamo framework and thus I need to build an EAR manifest which contains an entry with an {noformat}ATG-Class-Path{noformat} key (instead of {noformat}Class-Path{noformat}), so right now I'm using the same workaround suggested by opener:
{code:xml}
	<...>
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-dependency-plugin</artifactId>
		<executions>
			<execution>
				<id>get-classpath-for-manifest</id>
				<phase>generate-sources</phase>
				<goals>
					<goal>build-classpath</goal>
				</goals>
				<configuration>
					<outputProperty>atg-classpath</outputProperty> 
					<pathSeparator xml:space="preserve">@_@</pathSeparator>
					<fileSeparator>/</fileSeparator>
					<prefix>${lib-path}</prefix>
					<excludeTypes>war</excludeTypes>
				</configuration>
			</execution>
		</executions>
	</plugin>
	
	<plugin>
		<groupId>org.codehaus.mojo</groupId>
		<artifactId>build-helper-maven-plugin</artifactId>
		<version>${plugin.build-helper-maven-plugin.version}</version>
		<executions>
			<execution>
				<id>fix-classpath-for-manifest</id>
				<phase>generate-sources</phase>
				<goals>
					<goal>regex-property</goal>
				</goals>
				<configuration>
					<name>atg-classpath</name>
					<value>${atg-classpath}</value>
					<regex>@_@</regex>
					<replacement xml:space="preserve">&#x020;</replacement>
					<failIfNoMatch>false</failIfNoMatch>
				</configuration>
			</execution>
		</executions>
	</plugin>
	
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-ear-plugin</artifactId>
		<configuration>
			<archive>
				<manifestEntries>
					<ATG-Required>DAS</ATG-Required>
					<ATG-Web-Module>${war.artifactId}-${war.version}.war</ATG-Web-Module>
					<ATG-Build-Date>${maven.build.timestamp}</ATG-Build-Date>
					<ATG-Class-Path>classes ${atg-classpath}</ATG-Class-Path>
				</manifestEntries>
			</archive>
			<defaultLibBundleDir>${lib-path}</defaultLibBundleDir>
			<skinnyWars>true</skinnyWars>
			<modules>
				<webModule>
					<groupId>my.group.id</groupId>
					<artifactId>${war.artifactId}</artifactId>
					<contextRoot>/</contextRoot>
				</webModule>
			</modules>
		</configuration>
	</plugin>
	<...>
{code}
as he says, a fix would provide fora a more straightforward usage


was (Author: dinwath):
Another use Case: I'm dealing with an application that uses ATG Dynamo framework and thus I need to build an EAR manifest which contains an entry with an "ATG-Class-Path" key (instead of "Class-Path"), so right now I'm using the same workaround suggested by opener:
{code:xml}
	<...>
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-dependency-plugin</artifactId>
		<executions>
			<execution>
				<id>get-classpath-for-manifest</id>
				<phase>generate-sources</phase>
				<goals>
					<goal>build-classpath</goal>
				</goals>
				<configuration>
					<outputProperty>atg-classpath</outputProperty> 
					<pathSeparator xml:space="preserve">@_@</pathSeparator>
					<fileSeparator>/</fileSeparator>
					<prefix>${lib-path}</prefix>
					<excludeTypes>war</excludeTypes>
				</configuration>
			</execution>
		</executions>
	</plugin>
	
	<plugin>
		<groupId>org.codehaus.mojo</groupId>
		<artifactId>build-helper-maven-plugin</artifactId>
		<version>${plugin.build-helper-maven-plugin.version}</version>
		<executions>
			<execution>
				<id>fix-classpath-for-manifest</id>
				<phase>generate-sources</phase>
				<goals>
					<goal>regex-property</goal>
				</goals>
				<configuration>
					<name>atg-classpath</name>
					<value>${atg-classpath}</value>
					<regex>@_@</regex>
					<replacement xml:space="preserve">&#x020;</replacement>
					<failIfNoMatch>false</failIfNoMatch>
				</configuration>
			</execution>
		</executions>
	</plugin>
	
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-ear-plugin</artifactId>
		<configuration>
			<archive>
				<manifestEntries>
					<ATG-Required>DAS</ATG-Required>
					<ATG-Web-Module>${war.artifactId}-${war.version}.war</ATG-Web-Module>
					<ATG-Build-Date>${maven.build.timestamp}</ATG-Build-Date>
					<ATG-Class-Path>classes ${atg-classpath}</ATG-Class-Path>
				</manifestEntries>
			</archive>
			<defaultLibBundleDir>${lib-path}</defaultLibBundleDir>
			<skinnyWars>true</skinnyWars>
			<modules>
				<webModule>
					<groupId>my.group.id</groupId>
					<artifactId>${war.artifactId}</artifactId>
					<contextRoot>/</contextRoot>
				</webModule>
			</modules>
		</configuration>
	</plugin>
	<...>
{code}

> Allow for a space character as a pathSeparator in dependency:build-classpath
> ----------------------------------------------------------------------------
>
>                 Key: MDEP-541
>                 URL: https://issues.apache.org/jira/browse/MDEP-541
>             Project: Maven Dependency Plugin
>          Issue Type: Improvement
>          Components: build-classpath
>            Reporter: Giedrius Noreikis
>
> Currently, the {{dependency:build-classpath}} goal does not allow a space character to be specified as a {{pathSeparator}}, which is necessary to generate {{Class-Path}} values for manifests.
> Because of a check {{isPathSepSet = StringUtils.isNotEmpty( pathSeparator )}} in {{BuildClasspathMojo.java}}, the parameter gets ignored in this case, and the classpath is built with a default separator.
> The possible workaround is to fix the path with {{build-helper:regex-property}}:
> {code:xml}
>       <plugin>
>         <groupId>org.codehaus.mojo</groupId>
>         <artifactId>build-helper-maven-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>fix-classpath-for-manifest</id>
>             <phase>prepare-package</phase>
>             <goals><goal>regex-property</goal></goals>
>             <configuration>
>               <name>appClasspath</name>
>               <value>${appClasspath}</value>
>               <regex>;</regex>
>               <replacement xml:space="preserve"> </replacement>
>               <failIfNoMatch>false</failIfNoMatch>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
> {code}
> but a fix would allow for a more straightforward solution.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)