How to publish to eecoo repositories

aus eecoo wiki, der freien Wissensdatenbank

Publishing project artifacts

Pushing artifacts to either the public repository or the internal Maven 2 repository requires to things do be set up: once, for all projects at the same time you configure your server credentials in your local settings.xml. The file afterwards should nearly look like the following:

  ...
	<servers>
		<server>
			<id>eecoo-repo-public</id>
			<username>guest</username>
			<password>PASSWORD_FOR_GUEST</password>
			<filePermissions>664</filePermissions>
			<directoryPermissions>775</directoryPermissions>
		</server>
		<server>
			<id>eecoo-repo-internal</id>
			<username>YOUR_USERNAME</username>
			<password>YOUR_PASSWORD</password>
			<filePermissions>664</filePermissions>
			<directoryPermissions>775</directoryPermissions>
		</server>
	</servers>
   ...
</settings>

Second, you simply put the distributionManagement section into the pom.xml of the package you want to distribute with maven:

     ....
	<distributionManagement>
		<downloadUrl>http://maven.eecoo.net/internal</downloadUrl>
		<repository>
			<id>eecoo-repo-internal</id>
			<name>Internal eecoo.net Maven repository</name>
			<url>sftp://eecoo.net/internal-maven-repo</url>
			<uniqueVersion>false</uniqueVersion>
		</repository>
		<!--
		<snapshotRepository>
			<uniqueVersion>false</uniqueVersion>
			<id>eecoo-snapshot-repo-remote</id>
			<url></url>
		</snapshotRepository>
		<site>
			<id>eecoo-maven-site</id>
			<url></url>
		</site>
		-->
	</distributionManagement>
   </project>

You can distribute your project with the maven command:

   mvn deploy

Use mvn deploy:deploy ... to push dependent artifacts to the public repository. Refer to Maven's documentation for more information.

Publishing external artifacts

Sometimes you want to publish other developers artifacts (.jar-files) in our repository, i.e. if the artifact cannot be downloaded elsewhere. However, ensure that the license of the artifact you're about to publish allows redistribution (this is not yet examined for GNU GPL v2, but generally I think this would be okay; so for now just upload GPL v2 licensed projects).

To publish an artifact which has no dependencies yet, simply use:

 mvn deploy:deploy-file -DgroupId=GROUP_ID -DartifactId=ARTIFACT_ID -Dversion=VERSION -Dpackaging=jar -Dfile=ARTIFACT_JAR_FILE.jar -Durl=sftp://eecoo.net/[internal-]maven-repo -DrepositoryId=eecoo-repo-internal-upload -DgeneratePomFile=true 

This will automatically generate a simple pom.xml file for the artifact on the server.

To publish an artifact that has dependencies to other artifacts you first have to write a pom.xml file describing the dependencies (refer to http://maven.apache.org/pom.html for more information on doing that). Having that pom file in place execute the following command:

 mvn deploy:deploy-file -DgroupId=GROUP_ID -DartifactId=ARTIFACT_ID -Dversion=VERSION -Dpackaging=jar -Dfile=ARTIFACT_JAR_FILE.jar -Durl=sftp://eecoo.net/[internal-]maven-repo -DrepositoryId=eecoo-repo-internal-upload -DpomFile=YOUR_WRITTEN_ARTIFACT_POM_FILE.pom 

Note: we set the eecoo-repo-internal as repositoryId in order to use our internal server configuration (see above, settings.xml) which hold credentials that allow us to upload anything to the server via sftp. Currently you have to use the webhost user for doing that as he is the only one allowed to write to the repository directory.

'Persönliche Werkzeuge