Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to execute goal com.smoope.utils:j2objc-maven-plugin #16

Open
cyberneid opened this issue Mar 12, 2022 · 9 comments
Open

Failed to execute goal com.smoope.utils:j2objc-maven-plugin #16

cyberneid opened this issue Mar 12, 2022 · 9 comments

Comments

@cyberneid
Copy link

cyberneid commented Mar 12, 2022

I set the maven plugin as described in the readme.
But when I call mvn j2objc:convert I got the following error:

[ERROR] Failed to execute goal com.smoope.utils:j2objc-maven-plugin:1.1.5-SNAPSHOT:convert (default-cli) on project openpdf: Unable to parse configuration of mojo com.smoope.utils:j2objc-maven-plugin:1.1.5-SNAPSHOT:convert for parameter optional: Cannot find 'optional' in class com.smoope.utils.Dependency -> [Help 1]
[ERROR]

If I run mvn with -e option I got:

org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found for prefix 'j2objc' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/ugochirico/.m2/repository), sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots), central (https://repo.maven.apache.org/maven2)]

How can I fix that?

@vicmosin
Copy link
Member

vicmosin commented Mar 13, 2022

  1. Which jdk are you running on?
  2. Share the configuration from pom file

@cyberneid
Copy link
Author

I'm using Java SE 1.8.0_311
This is the pom

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.github.librepdf</groupId>
        <artifactId>openpdf-parent</artifactId>
        <version>1.3.28-SNAPSHOT</version>
    </parent>
    <artifactId>openpdf</artifactId>
    <properties>
        <java-module-name>com.github.librepdf.openpdf</java-module-name>
    </properties>
<pluginRepositories>
    <pluginRepository>
        <id>sonatype-nexus-snapshots</id>
        <name>sonatype-nexus-snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </pluginRepository>
</pluginRepositories>
    <dependencies>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk15on</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>fop</artifactId>
            <optional>true</optional>
        </dependency>
    </dependencies>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/resources-filtered</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <!-- unpack bundle, so humans can see the manifest without unpacking the jar -->
                    <unpackBundle>true</unpackBundle>
                    <instructions>
                        <!-- All com.lowagie.text.* packages are 'public' -->
                        <Export-Package>com.lowagie.text.*;version="${project.version}"</Export-Package>
                        <!-- Declare the Bouncycastle dependencies as optional -->
                        <Import-Package>org.bouncycastle.*;resolution:=optional,!com.lowagie.*,*</Import-Package>
                    </instructions>
                </configuration>
            </plugin>
            
            <plugin>
		<groupId>com.smoope.utils</groupId>
    			<artifactId>j2objc-maven-plugin</artifactId>
    			<version>1.0.1-SNAPSHOT</version>
			    <configuration>
			        <j2objcPath>/Users/ugochirico/Library/j2objc-2.8</j2objcPath>
			        <useArc>true</useArc>
        			<noPackageDirectories>true</noPackageDirectories>
        			<skipParent>true</skipParent>
        			<failOnErrors>false</failOnErrors>
        			<dependenciesOnly>true</dependenciesOnly> 
        			<dependencies>
        				<dependency>
				            <groupId>com.google.code.findbugs</groupId>
				            <artifactId>jsr305</artifactId>
				        </dependency>
				        <dependency>
				            <groupId>org.bouncycastle</groupId>
				            <artifactId>bcprov-jdk15on</artifactId>
				            <optional>true</optional>
				        </dependency>
				        <dependency>
				            <groupId>org.bouncycastle</groupId>
				            <artifactId>bcpkix-jdk15on</artifactId>
				            <optional>true</optional>
				        </dependency>
				        <dependency>
				            <groupId>org.apache.xmlgraphics</groupId>
				            <artifactId>fop</artifactId>
				            <optional>true</optional>
				        </dependency>
        			</dependencies>			    
        		</configuration>
		</plugin>
        </plugins>
    </build>
</project>

@vicmosin
Copy link
Member

vicmosin commented Mar 14, 2022

Could you try the latest snapshot version? It's 1.1.5-SNAPSHOT I guess. Or release 1.1.4

@cyberneid
Copy link
Author

Yes, I tried with the latest snapshot 1.1.5 and I got that error

@vicmosin
Copy link
Member

I am not sure what's the reason currently, will investigate it later, once I have more time. But I think the issue is <optional>true</optional> in dependencies section of the plugin's configuration. Could you try to remove them and put actual versions (if needed) and try again?

@cyberneid
Copy link
Author

cyberneid commented Mar 14, 2022

By removing the <optional>true</optional> I was able to go ahead.
Now I have another issue related to the source of the dependencies:

Build error - IO error: /Users/ugochirico/.m2/repository/org/bouncycastle/bcprov-jdk15on/bcprov-jdk15on--sources.jar (No such file or directory)

But I set this one to download the sources:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-repository-plugin</artifactId>
                <version>${maven-repository-plugin.version}</version>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
</plugin>

What else should I do?

@vicmosin
Copy link
Member

I guess plugin knows nothing about bcprov-jdk15on dependency (because you removed it), so maybe try to bring them back, but instead of marking them optional - set specific versions?
i.e.

<configuration>
	 <j2objcPath>/Users/ugochirico/Library/j2objc-2.8</j2objcPath>
	<useArc>true</useArc>
        <noPackageDirectories>true</noPackageDirectories>
        <skipParent>true</skipParent>
        <failOnErrors>false</failOnErrors>
        <dependenciesOnly>true</dependenciesOnly> 
        <dependencies>
		<dependency>
			<groupId>org.bouncycastle</groupId>
		        <artifactId>bcprov-jdk15on</artifactId>
			<version>x.y.z</version>
		</dependency>
                 ....

@GIovaB6
Copy link

GIovaB6 commented Mar 17, 2022

Thanks @vicmosin ,I've tried to set specific version for all dependency and i was able to go ahead.
But i have an error about opening a zip file.
I don't have information about wich file i can't able to open, do you have any suggestions?

this is my error
`
[ERROR] Failed to execute goal com.smoope.utils:j2objc-maven-plugin:1.1.4:convert (default-cli) on project openpdf: Build error - IO error: error in opening zip file -> [Help 1]

It happens when j2objc try to convert this dependency
<groupId>org.apache.xmlgraphics</groupId> <artifactId>fop</artifactId> <version>2.7</version>

@vicmosin
Copy link
Member

@GIovaB6 sorry for delay. Apparently something wrong with dependency, does it work if you remove it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants