buildJdk10 = 'JDK 10 (latest)'
buildMvn = 'Maven 3.5.2'
deploySettings = 'archiva-uid-jenkins'
+
INTEGRATION_PIPELINE = "Archiva-IntegrationTests-Gitbox"
pipeline {
label "${LABEL}"
}
+
+
stages {
stage('BuildAndDeploy') {
+ environment {
+ ARCHIVA_USER_CONFIG_FILE='/tmp/archiva-master-jdk-8-${env.JOB_NAME}.xml'
+ }
steps {
timeout(120) {
withMaven(maven: buildMvn, jdk: buildJdk,
}
post {
always {
+ sh "rm -f /tmp/archiva-master-jdk-8-${env.JOB_NAME}.xml"
junit testResults: '**/target/surefire-reports/TEST-*.xml'
}
success {
stage('JDKs') {
parallel {
stage('JDK9') {
+ environment {
+ ARCHIVA_USER_CONFIG_FILE='/tmp/archiva-master-jdk-9-${env.JOB_NAME}.xml'
+ }
steps {
ws("${env.JOB_NAME}-JDK9") {
checkout scm
}
}
}
+ post {
+ always {
+ sh "rm -f /tmp/archiva-master-jdk-9-${env.JOB_NAME}.xml"
+ }
+ }
}
stage('JDK10') {
+ environment {
+ ARCHIVA_USER_CONFIG_FILE='/tmp/archiva-master-jdk-10-${env.JOB_NAME}.xml'
+ }
steps {
ws("${env.JOB_NAME}-JDK10") {
checkout scm
}
}
}
+ post {
+ always {
+ sh "rm -f /tmp/archiva-master-jdk-10-${env.JOB_NAME}.xml"
+ }
+ }
}
}
}
import org.apache.archiva.redback.components.registry.RegistryException;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
{
DefaultArchivaConfiguration archivaConfiguration =
(DefaultArchivaConfiguration) lookup( ArchivaConfiguration.class, "default" );
+ String expectedFile = System.getProperty( "user.home" ) + "/.m2/archiva.xml";
+ String systemFile = System.getProperty(ArchivaConfiguration.USER_CONFIG_PROPERTY);
+ if (StringUtils.isNotEmpty( systemFile )) {
+ expectedFile = systemFile;
+ } else
+ {
+ String envFile = System.getenv( ArchivaConfiguration.USER_CONFIG_ENVVAR );
+ if ( StringUtils.isNotEmpty( envFile ) )
+ expectedFile = envFile;
+ }
archivaConfiguration.reload();
- assertEquals( System.getProperty( "user.home" ) + "/.m2/archiva.xml",
+ assertEquals( expectedFile,
archivaConfiguration.getUserConfigFilename() );
assertEquals( System.getProperty( "appserver.base", "${appserver.base}" ) + "/conf/archiva.xml",
archivaConfiguration.getAltConfigFilename() );
public void testLoadConfigurationFromInvalidBothLocationsOnDisk()
throws Exception
{
+ String propFile = System.getProperty( ArchivaConfiguration.USER_CONFIG_PROPERTY );
+ System.setProperty( ArchivaConfiguration.USER_CONFIG_PROPERTY, "${basedir}/target/*intentionally:invalid*/.m2/archiva-user.xml" );
ArchivaConfiguration archivaConfiguration =
lookup( ArchivaConfiguration.class, "test-not-allowed-to-write-to-both" );
Configuration config = archivaConfiguration.getConfiguration();
{
/* expected exception */
}
+ if (propFile!=null)
+ {
+ System.setProperty( ArchivaConfiguration.USER_CONFIG_PROPERTY, propFile );
+ }
}
@Test
<configuration>
<system/>
<jndi prefix="java:comp/env" config-optional="true"/>
- <xml fileName="${user.home}/.m2/archiva.xml" config-optional="true"
- config-name="org.apache.archiva.user"
- config-at="org.apache.archiva"/>
- <xml fileName="${user.home}/.m2/shared.xml" config-optional="true"
- config-name="org.apache.maven.shared.app.user" config-at="org.apache.maven.shared.app"
- config-forceCreate="true"/>
- <properties fileName="${user.home}/.m2/security.properties" config-optional="true"
- config-at="org.apache.archiva.redback"/>
- <properties fileName="${user.home}/.m2/archiva.properties" config-optional="true"
- config-at="org.apache.archiva.redback"/>
<xml fileName="${appserver.base}/conf/archiva.xml" config-optional="true"
config-name="org.apache.archiva.base"
config-at="org.apache.archiva"/>