You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@taverna.apache.org by Stian Soiland-Reyes <so...@cs.manchester.ac.uk> on 2015/01/05 11:36:33 UTC

Re: Scufl2 lib can parse t2flow when package with assembly Maven plugin

Here's how I do shading in scufl2-wfdesc, a similar single-JAR command
line tool:

https://github.com/taverna-incubator/incubator-taverna-language/blob/scufl2-wfdesc-0.3.8/pom.xml#L238

ServicesResourceTransformer will merge the META-INF/services/ files correctly.



On 31 December 2014 at 01:05, Stian Soiland-Reyes <st...@apache.org> wrote:
> Do you include the scufl2-t2flow jar?
>
> If you do any jar merging/shadowimg, make sure this file is appended rather
> than overwritten. You are using jar-with-dependencies which means a single
> jar, my guess is that the file is overwritten by the latest (or first)
> scufl2 jar that defines a WorkflowBundleReader.
>
> It should be possible to configure the assembly plugin to treat files in
> META-INF/services by appending rather than overwriting. If not, try to
> rearrange the scufl2 dependencies in your pom (list scufl2-api explicitly).
>
> You can also inject manually (which the OSGi services do), but as long as
> you don't call setReaders then the java.util.ServiceLoader should do the
> job.
>
> On 30 Dec 2014 11:23, "Matías Fernández" <re...@gmail.com> wrote:
>>
>> Hello guys,
>>
>> We are using the Scufl2 library to parse the files t2flow, at the
>> beginning we have been using it like this.
>>
>> final WorkflowBundleIO io = new WorkflowBundleIO();
>> final File t2File = new File(workflowPath);
>>
>> final WorkberchTopologyBuilder builder = new WorkberchTopologyBuilder();
>> try {
>> final WorkflowBundle wfBundle = io.readBundle(t2File,
>> "application/vnd.taverna.t2flow+xml");
>>
>>
>> But when we package the code with the library with the assembly plug-in on
>> Maven, this code run on a exception because the the media type doesn't
>> exist. After read the code of the Scufl2 library, we found there is a spring
>> injection which determinate the media type supported.
>> For some reason when we package the software with dependencies, this
>> injection doesn't happen, do you know which can be the issue?
>>
>> This is the assemble plug-in configuration on my pom.xml file.
>>
>> <plugin>
>>          <artifactId>maven-assembly-plugin</artifactId>
>>          <configuration>
>> <archive>
>> <manifest>
>> <mainClass>main.java.DynamicWorkberchTopologyMain</mainClass>
>> </manifest>
>> </archive>
>> <descriptorRefs>
>> <descriptorRef>jar-with-dependencies</descriptorRef>
>> </descriptorRefs>
>>          </configuration>
>>          <executions>
>> <execution>
>> <id>make-assembly</id>
>> <phase>package</phase>
>> <goals>
>> <goal>single</goal>
>> </goals>
>> </execution>
>>           </executions>
>> </plugin>
>>
>>
>> Right now I'm creating the parse for t2flow directly but is a good point
>> to have this generic interface to use different types of workflows
>> definition.
>>
>> Thanks,
>> Matías.



-- 
Stian Soiland-Reyes, myGrid team
School of Computer Science
The University of Manchester
http://soiland-reyes.com/stian/work/ http://orcid.org/0000-0001-9842-9718

Re: Scufl2 lib can parse t2flow when package with assembly Maven plugin

Posted by Matías Fernández <re...@gmail.com>.
Hey Stian,

Thanks for your answer, I'm going to take a look on it.

Thanks,
Matías.

On 05/01/15 08:36, Stian Soiland-Reyes wrote:
> Here's how I do shading in scufl2-wfdesc, a similar single-JAR command
> line tool:
>
> https://github.com/taverna-incubator/incubator-taverna-language/blob/scufl2-wfdesc-0.3.8/pom.xml#L238
>
> ServicesResourceTransformer will merge the META-INF/services/ files correctly.
>
>
>
> On 31 December 2014 at 01:05, Stian Soiland-Reyes <st...@apache.org> wrote:
>> Do you include the scufl2-t2flow jar?
>>
>> If you do any jar merging/shadowimg, make sure this file is appended rather
>> than overwritten. You are using jar-with-dependencies which means a single
>> jar, my guess is that the file is overwritten by the latest (or first)
>> scufl2 jar that defines a WorkflowBundleReader.
>>
>> It should be possible to configure the assembly plugin to treat files in
>> META-INF/services by appending rather than overwriting. If not, try to
>> rearrange the scufl2 dependencies in your pom (list scufl2-api explicitly).
>>
>> You can also inject manually (which the OSGi services do), but as long as
>> you don't call setReaders then the java.util.ServiceLoader should do the
>> job.
>>
>> On 30 Dec 2014 11:23, "Matías Fernández" <re...@gmail.com> wrote:
>>> Hello guys,
>>>
>>> We are using the Scufl2 library to parse the files t2flow, at the
>>> beginning we have been using it like this.
>>>
>>> final WorkflowBundleIO io = new WorkflowBundleIO();
>>> final File t2File = new File(workflowPath);
>>>
>>> final WorkberchTopologyBuilder builder = new WorkberchTopologyBuilder();
>>> try {
>>> final WorkflowBundle wfBundle = io.readBundle(t2File,
>>> "application/vnd.taverna.t2flow+xml");
>>>
>>>
>>> But when we package the code with the library with the assembly plug-in on
>>> Maven, this code run on a exception because the the media type doesn't
>>> exist. After read the code of the Scufl2 library, we found there is a spring
>>> injection which determinate the media type supported.
>>> For some reason when we package the software with dependencies, this
>>> injection doesn't happen, do you know which can be the issue?
>>>
>>> This is the assemble plug-in configuration on my pom.xml file.
>>>
>>> <plugin>
>>>           <artifactId>maven-assembly-plugin</artifactId>
>>>           <configuration>
>>> <archive>
>>> <manifest>
>>> <mainClass>main.java.DynamicWorkberchTopologyMain</mainClass>
>>> </manifest>
>>> </archive>
>>> <descriptorRefs>
>>> <descriptorRef>jar-with-dependencies</descriptorRef>
>>> </descriptorRefs>
>>>           </configuration>
>>>           <executions>
>>> <execution>
>>> <id>make-assembly</id>
>>> <phase>package</phase>
>>> <goals>
>>> <goal>single</goal>
>>> </goals>
>>> </execution>
>>>            </executions>
>>> </plugin>
>>>
>>>
>>> Right now I'm creating the parse for t2flow directly but is a good point
>>> to have this generic interface to use different types of workflows
>>> definition.
>>>
>>> Thanks,
>>> Matías.
>
>