How can I publish my Protobuf Schema to HERE OLP China? - proto

I have my Protobuf Schema published to http://platform.here.com and I would like to publish the same schema to https://platform.hereolp.cn, but I cannot find any documentation how to do it.
The only documentation I have found is this one: https://developer.here.com/olp/documentation/archetypes/dev_guide/index.html

I managed to publish my schema. I downloaded different set of credentials (credentials.properties) from https://platform.hereolp.cn, similar as it is written here, and then saved it to ~/.here directory.
I also switched to the latest HERE Wagon Plugin 1.6.1 as it is described in dependency management. I have changed version and repository url:
<artifact.wagon.version>1.6.1</artifact.wagon.version>
and
<repositories>
<repository>
<id>HERE_PLATFORM_ARTIFACT</id>
<layout>default</layout>
<url>here+artifact-service://artifact-service</url>
</repository>
</repositories>
It seems that HERE Wagon Plugin resolves repository link here+artifact-service://artifact-service differently depending on credentials.properties file.
Now the schema can be published to both web sites without code changes. I only need to change credentials.properties in ~/.here directory

Related

What is default of repository in maven

I am new to use maven to build projects, and IDE I am using is eclipse. For projects I built before, I never used attributes <repository> in POM file and they are running very well.
But when I read some projects in github, they always come with a POM file containing quite a lot of <repository>. After reading maven official website, I know that <repositories> are location to download jar files, but I am able to import all classes only specifying <dependencies> not <repositories>.
My question is why can I download libs without specify <repositories>? Is there a default value for repositories.
Yes there is the Maven Central repository, which is automatically bundled with your pom.xml / settings.xml if you don't specify one.
You usually specify a repo in your pom.xml when you need to access an artifact that your company produces internally, or when you want to reference snapshots or the third-party company you're working with hasn't given their artifacts to Central.

How to make sure a tycho build doesn't include snapshot dependencies

During a non-tycho release, Maven checks if there are snapshot dependencies in the project being built.
Is there a way to do the same thing with an E4 project, built with Tycho?
p2 repositories don't have a (formal) notion of snapshot and non-snapshot artifacts. So technically you never have snapshot dependencies in a Tycho build, as long as you don't use SNAPSHOT artifacts from Maven repositories via pomDependencies=consider. The latter can be prevented in the same way as in Maven, i.e. by controlling the Maven repositories in your settings.xml (see e.g. this other answer).
But probably this isn't what you are looking for. You probably want to make sure that you don't reference artifacts which will disappear eventually and make your build non-reproducible. For this, you have to check the retention policy of the referenced p2 repositories and make sure that you only reference p2 repositories which are retained "forever". (Example: Retention policy of the Eclipse project p2 repositories.)
If the retention policies are not good enough (or you don't trust the providers to actually stick to them), you need to store copies of the referenced p2 repositories. You can for example download the p2 repositories as zip (or mirror the repository and zip it yourself), deploy it to a Nexus OSS and access it from your build via the Unzip Plugin. (Disclaimer: The Unzip Plugin is an offering of the Tycho project, of which I am a committer.)
Have a look at the Maven Settings References:
Repositories:
releases, snapshots: These are the policies for each type of artifact, Release or snapshot. With these two sets, a POM has the power to alter the policies for each type independent of the other within a single repository. For example, one may decide to enable only snapshot downloads, possibly for development purposes.
enabled: true or false for whether this repository is enabled for the respective type (releases or snapshots).
updatePolicy: This element specifies how often updates should attempt to occur. Maven will compare the local POM's timestamp (stored in a repository's maven-metadata file) to the remote. The choices are: always, daily (default), interval:X (where X is an integer in minutes) or never.
checksumPolicy: When Maven deploys files to the repository, it also deploys corresponding checksum files. Your options are to ignore, fail, or warn on missing or incorrect checksums.
layout: In the above description of repositories, it was mentioned that they all follow a common layout. This is mostly correct. Maven 2 has a default layout for its repositories; however, Maven 1.x had a different layout. Use this element to specify which if it is default or legacy.
I think the setting you're after could approximate the following.
<repository>
<id>my-repo</id>
<name>My Repo</name>
<url>http://my.repo.org</url>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>

Using mvn deploy via webdav: directory creation

I managed to setup maven so it automatically uploads the latest snapshot of our software to our public maven repository.
This works fine so far, there is only a minor shortcoming that I just can not handle:
When deploying a new Snapshot, say for example:
<version>1.2-SNAPSHOT</version>
a directory named 1.2-SNAPSHOT has to be present on our webserver's maven directory, otherwise maven will fail, stating:
Failed to deploy artifacts: Could not transfer artifact ... from/to basex.mvn
(http://abc.de/webdav/): Access denied to: http://abc.de/webdav/1.2-SNAPSHOT/...
As usually when starting a new snapshot this very directory is not yet present so I end up creating it manually.
Do you have any ideas on how to come around this and make maven create this folder?
Are you sure that it is not a server side problem?
I deployed a some libraries using Webdav (over HTTPS) and first time (with directory creation) it worked.
The Pom.xml should contain a description of the distribution server.
<distributionManagement>
<repository>
<id>RepoId</id>
<name>Name of the Maven repository</name>
<url>dav:https://thewebdavurl/</url>
<uniqueVersion>false</uniqueVersion>
</repository>
</distributionManagement>
To enable directory creation, you might need to log on the server. To do this you need to add in the server part of the setting.xml the credentials for RepoId (see id of the repository in the pom).
<server>
<id>RepoId</id>
<username>login</username>
<password>pass</password>
</server>

Maven local repository in CVS?

I would like to use my CVS as maven repository.. can anyone give suggestions?
There are 2 ways:
a) If you want to use it only in one project place a 'repo' directory at the toplevel. Than add jars in the maven convention (groupid in folders/artifactid/version/artifactif-version.jar).
To use this as a repository declare a file based repository in your pom.
<repositories>
<repository>
<id>some-repo</id>
<name>some-repo</name>
<url>file://${basedir}/repo</url>
<releases>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
</repositories>
If you use this from a module pom you have to use a url relative to your module pom.
b) if you want to use it for several projects there are socalled 'wagons'. There is one for svn. These maven plugins let you use a SCM as repository. I don't know whether there is a cvs-wagon.
I would not put the dependencies in an SCM system like CVS for many reasons.
Each time you update a dependency in the pom, you need to manually add the corresponding dependency jar - in the exact same folder structure as expected by maven.
You need to worry about transitive dependencies and it can be overwhelming.
Since these dependencies do not change (except if they are SNAPSHOTS), SCM is an overkill for them. Each time there is a new version of the dependency, it needs to be in a different folder structure.
If you want to have control over the dependencies, you could create your own maven mirror using a repository manager. These store the dependencies typically using some content management libraries and can be backed up/archived.
On a related note, Maven Wagon SCM Provider can be used to publish projects to an SCM, but has not been tested with SCM based remote repository.

How does Maven2 know where to find plugins?

I'm using Maven2 and I can't seem to find any plugins in my repository. I'm getting errors like
repository metadata for:
'org.apache.maven.plugins' could not
be found on repository: myrepo
where myrepo is the name of my repository.
My question is how does Maven know where to find plugins? There's a reference in my error to metadata, what metadata is expected where and what format must it take? I've not had much luck so far looking for documentation...
(I'm not interested in the easy answer to use the central repo, I want to know why myrepo isn't working.)
Thanks!
In the root of each artifact (relative path to repository root [groupId]/[artifactId]), Maven expects to find a maven-metadata.xml file. It uses this file to determine the available versions, the latest version, and the released version.
For example common-logging's metadata from repo1 lists all the available versions and tells us the release version is 1.1.1 as of 28th Nov 2008.
<?xml version="1.0" encoding="UTF-8"?><metadata>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<versioning>
<release>1.1.1</release>
<versions>
<version>1.0</version>
<version>1.0.1</version>
<version>1.0.2</version>
<version>1.0.3</version>
<version>1.0.4</version>
<version>1.1</version>
<version>1.1.1</version>
</versions>
<lastUpdated>20071128191817</lastUpdated>
</versioning>
</metadata>
Maven will download the metadata for each remote repository to your local repository (with the name maven-metadata-[repo name].xml) so it can check the available versions without having to hit each repository each time. If you want to force Maven to refetch the metadata you can do so with the "-U" switch on the commandline.
If you have your own repository, it needs to publish this kind of metadata so Maven can determine if any of the versions are available is the right one. The simplest way to do this is to use a repository manager like Nexus or Artifactory which will both manage the metadata for you.