Page 1 of 1

Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Mon Jan 06, 2020 7:09 pm
by wmaclean
Hello,
I am trying to configure Maven and start a project, as documented here:
https://www.oxygenxml.com/oxygen_sdk/download.html

I am using:
  • Windows 10
  • Eclipse Version: 2019-12 (4.14.0)
  • Oxygen 21.1
The m2e plugin is now part of the current Eclipse installer I am using, eclipse-inst-win64.exe. I have the settings.xml set up for the proxy and for the archetype:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
    https://maven.apache.org/xsd/settings-1.0.0.xsd">
    <profiles>
        <profile>
            <repositories>
                <repository>
                    <id>oxygenxml</id>
                    <name>Oxygen XML</name>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                        <checksumPolicy>warn</checksumPolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                        <checksumPolicy>fail</checksumPolicy>
                    </snapshots>
                    <url>http://www.oxygenxml.com/maven</url>
                    <layout>default</layout>
                </repository>
            </repositories>
        </profile>
    </profiles>
    <proxies>
        <proxy>
            <id>myproxy</id>
            <active>true</active>
            <protocol>http</protocol>
            <host>a.proxy.com</host>
            <port>9090</port>
            <username></username>
            <password></password>
            <nonProxyHosts>localhost,127.0.0.1</nonProxyHosts>
        </proxy>
    </proxies>
</settings>
Following the task called "Creating a Startup Project Sample from a Command Line", I've tried the following from the command line, both from the internet directly and from behind the proxy, like this:

Code: Select all

mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=com.oxygenxml.samples -DarchetypeArtifactId=oxygen-sdk-samples-archetype -DarchetypeVersion=21.1.0.2 -DgroupId=myGroup -DartifactId=mySample  -Dversion=1.0-SNAPSHOT -DarchetypeRepository=http://oxygenxml.com/maven/
And get the following error:

Code: Select all

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
When I run it with -X, I get this additional error:

Code: Select all

Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Following the task called "Creating a Startup Project from the Eclipse IDE", from both accessing the internet directly or behind the proxy, I try to add the following archetype:
  • archetypeGroupId: com.oxygenxml.samples
  • archetypeArtifactId: oxygen-sdk-samples-archetype
  • archetypeVersion: 21.1.0.2
But get the following error:

Code: Select all

Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2
org.eclipse.core.runtime.CoreException: Could not resolve artifact
What can I try next?

I've tried the following suggestions from this site, but either they don't work or they don't apply. Maybe because they are for earlier versions of Eclipse:
Thanks for your help,
Will

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Tue Jan 07, 2020 12:35 pm
by alex_jitianu
Hi Will,

Such exceptions usually happen when maven connects to a repository through HTTPS, but as I see from your snapshots, the URLs to the repository are all with HTTP. I'm not entirely sure why would Maven use https... What version of Maven are you using? Perhaps the proxy is receiving plain HTTP requests from clients and forwarding HTTPS requests to upstream servers transparently?

There is a procedure on stackoverflow describing how to make the certificate known to the maven process. You'll need to get the certificate from https://www.oxygenxml.com/maven/, instead.

Anyway, what to you want to do with the SDK? Customize the Standalone distribution, the Eclipse plugin or the Web Author? Is it a framework-level customization or a plugin one? As a workaround, if you need to create a Workspace Access plugin, there is a startup project available on GitHub which perhaps wont fall into this error.


Best regards,
Alex

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Wed Jan 08, 2020 8:46 pm
by wmaclean
Hello Alex,
Thank you very much for your response! You gave me some great info to work with.

I am trying to develop a plugin for the standalone version of Oxygen, which will be distributed to a team of internal writers.

The maven version is the one that comes with the current Eclipse install:

Code: Select all

Eclipse.org - m2e	Maven Integration for Eclipse	1.14.0.20191209-1925	org.eclipse.m2e.feature
Using the info you gave, I managed to build a project from the command-line console, after configuring the certificate. But when I open the project in Eclipse, it won't build - it has the following errors:

Code: Select all

Description	Resource	Path	Location	Type

Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from/to central (https://repo.maven.apache.org/maven2): www-proxy.us.oracle.com	pom.xml	/bundle-options	line 1	Maven Configuration Problem

Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from/to central (https://repo.maven.apache.org/maven2): www-proxy.us.oracle.com	pom.xml	/oxygen-sample-swing-component	line 1	Maven Configuration Problem
It looks like Eclipse is having the same certification issue we had at the command line, so tried to configure the MAVEN_OPTS environment variable as:

Code: Select all

-Xmx512m -Djavax.net.ssl.trustStore=trust.jks -Djavax.net.ssl.trustStorePassword= -Djavax.net.ssl.keyStore=C:\temp\mavenKeystore -Djavax.net.ssl.keyStoreType=pkcs12 -Djavax.net.ssl.keyStorePassword=<password>
But, still the same issues.

I am researching more on MAVEN_OPTS, in case I am configuring it wrong.

I was also able to get the project from GIT hub, but had the same issue:

Code: Select all

Description	Resource	Path	Location	Type

Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:3.0.2 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:3.0.2 from/to central (https://repo.maven.apache.org/maven2): www-proxy.us.oracle.com	pom.xml	/sample-plugin-workspace-access	line 1	Maven Configuration Problem
Would you have any other insight, or ideas I can try?

I really appreciate your help.
Will

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Thu Jan 09, 2020 9:17 am
by alex_jitianu
Hi Will,

From what I've read, m2e doesn't honor MAVEN_OPTS. The first thing that comes to mind is to configure Eclipse to use the external Maven installation, the same you've used to create the project. In the past I had to do that myself to bypass various strange errors. To do that, you need to go to Preferences, on page Installations. Afterwards, Eclipse will invoke the external maven which should take into account the MAVEN_OPTS environment variable.

Best regards,
Alex

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Fri Jan 10, 2020 11:55 pm
by wmaclean
Hi Alex,
I just realized – is this your training on youtube (https://youtu.be/23YSwgxyX-c)? It’s a great introduction. Thanks very much for posting it.

I’ve added the external maven install to Windows > Preferences > Maven > Installations.

I’ve tried several variations of MAVEN_OPTS:

Code: Select all

-Xmx512m -Djavax.net.ssl.trustStore=trust.jks -Djavax.net.ssl.trustStorePassword= -Djavax.net.ssl.keyStore=C:\temp\mavenKeystore -Djavax.net.ssl.keyStoreType=pkcs12 -Djavax.net.ssl.keyStorePassword=<password>
And:

Code: Select all

-Djavax.net.ssl.trustStore=C:\temp\mavenKeystore
And:

Code: Select all

	-Djavax.net.ssl.trustStore=C:\temp\mavenKeystore -Djavax.net.ssl.trustStorePassword=<password>
Each change, I restart Eclipse and try to to rebuild with Run > Run As > Maven Install – which I read is the way to use the external Maven.

But it still won’t resolve:

Code: Select all

[ERROR] Failed to execute goal on project mySample: Could not resolve dependencies for project myGroup:mySample:pom:1.0-SNAPSHOT: Failed to collect dependencies at com.oxygenxml:oxygen-sdk:jar:21.1.0.2: Failed to read artifact descriptor for com.oxygenxml:oxygen-sdk:jar:21.1.0.2: Could not transfer artifact com.oxygenxml:oxygen-sdk:pom:21.1.0.2 from/to oxygenxml (https://oxygenxml.com/maven/): Transfer failed for https://oxygenxml.com/maven/com/oxygenxml/oxygen-sdk/21.1.0.2/oxygen-sdk-21.1.0.2.pom ProxyInfo{host='proxy-server.com', userName='null', port=80, type='http', nonProxyHosts='null'}: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
I’m still researching, in case I’m using the MAVEN_OPTS JVM parameters wrong.

Also researching other possibilities.

Have you tried setting the options in the .mvn/jvm.config file (https://maven.apache.org/configure.html)? Is that a valid option for Eclipse?

In Eclipse > Windows > Preferences > Maven > Source Lookup, I see “VM Arguments and “.launch file VM arguments”. Would either of those be the JVM running MVN? Would either of those take the trustStore parameters?

Thank you very much for your help, and have a good weekend.
Will

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Tue Jan 14, 2020 5:05 pm
by alex_jitianu
Hi Will,

Thank you for the kind words!

You are right! I've tested myself and the Eclipse m2e plugin doesn't take into account the MAVEN_OPTS system property. I've tested the .mvn/jvm.config file as well and that too is completely ignored.

If I understand it correctly, you are at the point where you have the plugin project, you just need to be able to execute maven commands from within Eclipse. To do that you can configure individual maven commands. For example let's assume that you want to build your project which is normally done by running mvn package. You would do it like this:
- in Eclipse Package Explorer, invoke the contextual menu on the project and choose Run as-> Maven build...
- a configuration dialog appears. In the Goals field enter: package
- select the JRE tab and in the VM arguments text area put all those properties:

Code: Select all

-Xmx512m -Djavax.net.ssl.trustStore=trust.jks -Djavax.net.ssl.trustStorePassword= -Djavax.net.ssl.keyStore=C:\temp\mavenKeystore -Djavax.net.ssl.keyStoreType=pkcs12 -Djavax.net.ssl.keyStorePassword=<password>
- give the configuration a name in the top text field so that you are able to quickly identify it
- click Run

You can save this configuration as a Favorites to make it more accessible. The Run as... action on the Eclipse toolbar has in its dropdown has a Organize Favorites... action.

Best regards,
Alex

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Wed Jan 15, 2020 11:56 pm
by wmaclean
Hello Alex,
Thanks very much – I really appreciate the help. Using what you just posted, with one difference, I was able to build. What I did was:

1. In Eclipse Package Explorer, right-click on the project and selected Run as-> Maven build...
2. On the Edit Configuration dialog, Main tab, entered “package” in the Goals field.
3. On the Edit Configuration dialog, JRE tab, entered the following in the VM arguments field:

Code: Select all

-Dmaven.wagon.http.ssl.insecure=true
From what I understand, this parameter enables the use of “relaxed” SSL checks for user certificates.
Because no matter what I tried, I couldn’t get the actual trustStore JVM parameters to work in Eclipse.

But now that it has built, the pom shows two errors:

Code: Select all

Multiple annotations found at this line:

	- Failure to transfer com.oxygenxml:oxygen-sdk:jar:21.1.0.2 from https://oxygenxml.com/
	 maven/ was cached in the local repository, resolution will not be reattempted until the update 
	 interval of oxygenxml has elapsed or updates are forced. Original error: Could not transfer artifact 
	 com.oxygenxml:oxygen-sdk:jar:21.1.0.2 from/to oxygenxml (https://oxygenxml.com/maven/): 
	 sun.security.validator.ValidatorException: PKIX path building failed: 
	 sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to 
	 requested target org.eclipse.aether.transfer.ArtifactTransferException: Failure to transfer 
	 com.oxygenxml:oxygen-sdk:jar:21.1.0.2 from https://oxygenxml.com/maven/ was cached in the 
	 local repository, resolution will not be reattempted until the update interval of oxygenxml has 
	 elapsed or updates are forced. Original error: Could not transfer artifact com.oxygenxml:oxygen-
	 sdk:jar:21.1.0.2 from/to oxygenxml (https://oxygenxml.com/maven/): 
	 sun.security.validator.ValidatorException: PKIX path building failed: 
	 sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to 
	 requested target at ....
	
	- Missing artifact com.oxygenxml:oxygen-sdk:jar:21.1.0.2
Now that I’ve built, isn’t com.oxygenxml:oxygen-sdk:jar downloaded as part of the project build? How can I fix this?

I found a bunch of files in the following folder:

Code: Select all

C:\Users\<another_folder>\.eclipse\org.eclipse.oomph.p2\cache
Do I need to delete something there?

Thanks again,
Will

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Thu Jan 16, 2020 11:00 am
by alex_jitianu
Hi Will,

I'm glad to hear that you made it work!
But now that it has built, the pom shows two errors:
These errors appear when you open the pom file, right? The custom configuration you created, the one with VM arguments, is not used in this particular case. If these errors are the only nuisance then I suggest to just ignore them.

Best regards,
Alex

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Sat Jan 18, 2020 12:10 am
by wmaclean
Hello Alex,
I am working through the training video you posted now. Again, it is excellent - thanks very much for that!

I think something is missing from my setup, though.
  • I don't get the autocorrect features after deleting everything from the

    Code: Select all

    CustomWorkspaceAccessPluginExtension.java
    , as you do in the video
  • When I manually type the

    Code: Select all

    applicationStarted
    and

    Code: Select all

    applicationClosing
    methods, then try to view the autocomplete list for the

    Code: Select all

    pluginWorkspace
    object, I get a dialog that says "The compilation unit is not on the build path of a Java project"
Any ideas? Am I still missing the jar file for the Oxygen API? That would seem strange, because it built.

Have a good weekend.
Will

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Mon Jan 20, 2020 1:47 pm
by alex_jitianu
Hi Will,

Yes, it sounds like there are still missing jars... If you take a look at the project structure inside Eclipse's Package Explorer view, you should be able to see a Maven Dependencies entry. If you expand it, do you see an entry labeled oxygen-{version}.jar ?

I think I may have found an option to pass those system properties to the JVM used by the .:
1. Go to Preferences on page Installed JREs
2. Edit the default JRE (the one with a selected check box to its left) and click Edit
3. There's a text field named Default VM arguments. Put the

Code: Select all

-Djavax.net.ssl.trustStore=........
arguments there (actually all the arguments that were required to get the build running in the command line)

Actually, to be sure, if you have multiple JREs defined inside Eclipse's options, you can set those properties to all of them (just in case the Maven build prefers a different one).


Best regards,
Alex

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Wed Jan 22, 2020 6:27 pm
by wmaclean
Hello Alex,
Thanks very much.

I couldn't find the Maven Dependencies option under Package Explorer for the project created from the command line.

So instead, I created a new Workspace and followed the instructions you sent last round, with a small change:

1. Go to Preferences on page Installed JREs
2. Edit the default JRE (the one with a selected check box to its left) and click Edit
3. There's a text field named Default VM arguments. Put the

Code: Select all

-Dmaven.wagon.http.ssl.insecure=true
command.

And I was able to create a project from the maven archetype. The code autocomplete works, too.

I was able to get through part of your training on youtube. I got as far as modifying the

Code: Select all

CustomWorkspaceAccessPluginExtension.java
file with overriding the

Code: Select all

customizeView
in the

Code: Select all

applicationStarted
override, and it all compiled, deployed to the Oxygen \plugins folder, and the SampleWorkspaceID view is visible in Oxygen, just like in the training.

But, I am getting the following error, in both Eclipse:

Code: Select all

24527 ERROR [ Addons checker ] ro.sync.exml.addons.ExtensionInfo - ro.sync.exml.addons.d: Unable to load add-on "com.oxygenxml.plugin.WorkspaceAccess". The version must have this "MAJOR.MINOR.PATCH" pattern. Current version: 0.0.1-SNAPSHOT.0.
ro.sync.exml.addons.d: Unable to load add-on "com.oxygenxml.plugin.WorkspaceAccess". The version must have this "MAJOR.MINOR.PATCH" pattern. Current version: 0.0.1-SNAPSHOT.0.
	at ro.sync.exml.addons.ExtensionInfo.b(Unknown Source)
	at ro.sync.exml.addons.ExtensionInfo.e(Unknown Source)
	at ro.sync.exml.addons.ExtensionInfo.createExtension(Unknown Source)
	at ro.sync.exml.addons.b.h(Unknown Source)
	at ro.sync.exml.addons.b.f(Unknown Source)
	at ro.sync.exml.addons.ExtensionsManager.<init>(Unknown Source)
	at ro.sync.exml.addons.b.b.<init>(Unknown Source)
	at ro.sync.exml.addons.b.b.<init>(Unknown Source)
	at ro.sync.exml.addons.c.c.lzd(Unknown Source)
	at ro.sync.exml.addons.c.c.dxd(Unknown Source)
	at ro.sync.ui.application.mb.run(Unknown Source)
And the same error in Oxygen:

Code: Select all

Severity: error
Description: Unable to load add-on "com.oxygenxml.plugin.WorkspaceAccess". The version must have this "MAJOR.MINOR.PATCH" pattern. Current version: 0.0.1-SNAPSHOT.0.
In plugin.xml, I tried modifying

Code: Select all

version="1.1.1"
, just to see if it helps - and I still get the same error.

Still searching online for an answer.

Anyway - thanks a ton for your help!
Will

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Thu Jan 23, 2020 10:02 am
by alex_jitianu
Hi Will,
I couldn't find the Maven Dependencies option under Package Explorer for the project created from the command line.
That's probably because Eclipse didn't detected the Maven nature of the project. When that happens, you can go to the Project Explorer, show the contextual menu on the project and select Configure->Convert to Maven project

The error you are receiving relates to the extension.xml file. that file is useful for packing the plugin as an add-on. The file contains Maven variables that should be expanded when the project is built:

Code: Select all

    <xt:version>${project.parent.version}.0</xt:version>
    <xt:oxy_version>${project.parent.version}</xt:oxy_version>
Anyway, the error is nothing to be worry about! You can look inside assembly.xml or assemblyComponent.xml and check if you see a block like this:

Code: Select all

		<file>
			<source>extension.xml</source>
			<outputDirectory>/</outputDirectory>
			<filtered>true</filtered>
		</file>
The "filtered" flags tells the build process that this file contains variables that should be expanded. You can also zip the project and send it on support@oxygenxml.com and I will take a quick look to see why the expansion is not working.

Best regards,
Alex

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Wed Jan 29, 2020 1:05 am
by wmaclean
Hi Alex,
For now, I am just going to ignore the version error, because everything else is working.

I was able to make it through your training class on youtube (https://youtu.be/23YSwgxyX-c). It was a great introduction - thank you very much for posting it! Do you have other videos, or other such excellent resources?

Thanks a ton - I really appreciate your help!
Will

Re: Can't resolve Archetype com.oxygenxml.samples:oxygen-sdk-samples-archetype:21.1.0.2

Posted: Tue Feb 04, 2020 5:22 pm
by alex_jitianu
Hi Will,

The SDK landing page is a good starting point to understand what kind of customization you need and to decide in what direction to go. If you give me more details about how you want to extend Oxygen , what extra functionality you need, then perhaps I can point you to more resources.

Best regards,
Alex