--- /dev/null
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+version: 2
+updates:
+ - package-ecosystem: "maven"
+ directory: "/"
+ schedule:
+ interval: "daily"
+
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
--- /dev/null
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+_extends: archiva-parent
+tag-template: archiva-2.x-$NEXT_MINOR_VERSION
\ No newline at end of file
--- /dev/null
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: GitHub CI
+
+on:
+ push:
+ pull_request:
+
+
+jobs:
+ build:
+
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ java: [8]
+ fail-fast: true
+
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Set up JDK
+ uses: actions/setup-java@v2.3.1
+ with:
+ distribution: temurin
+ java-version: ${{ matrix.java }}
+ cache: 'maven'
+
+ - name: Build with Maven
+ run: mvn -e -B -V install
--- /dev/null
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Release Drafter
+on:
+ push:
+ branches:
+ - archiva-2.x
+jobs:
+ update_release_draft:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: release-drafter/release-drafter@v5
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
+++ /dev/null
-language: java
-jdk:
- - openjdk7
- - oraclejdk7
- - oraclejdk8
-
-before_install: "mvn clean install -DskipTests=true -B -V -Pci-build"
-
-script: "mvn clean install -B -V -Pit-js -Pci-build"
-
-cache:
- directories:
- - $HOME/.m2
-branches:
- except:
- - gh-pages
-notifications:
- email:
- - olamy@apache.org
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>jdk9+</id>
+ <activation>
+ <jdk>[1.9,)</jdk>
+ </activation>
+ <dependencies>
+ <!-- needed for jdk 11 -->
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
</project>
</plugin>
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>jdk9+</id>
+ <activation>
+ <jdk>[1.9,)</jdk>
+ </activation>
+ <dependencies>
+ <!-- needed for jdk 11 -->
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
</project>
implements ManagedRepositoryAdmin
{
- private Logger log = LoggerFactory.getLogger( getClass() );
+ private final Logger log = LoggerFactory.getLogger( getClass() );
public static final String STAGE_REPO_ID_END = "-stage";
return Collections.emptyList();
}
- List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>( managedRepoConfigs.size() );
+ List<ManagedRepository> managedRepos = new ArrayList<>( managedRepoConfigs.size() );
for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
{
}
catch ( Exception e )
{
- log.warn( new StringBuilder( "Unable to scan repository [" ).append( repoId ).append( "]: " ).append(
- e.getMessage() ).toString(), e );
+ log.warn("Unable to scan repository [" + repoId + "]: " + e.getMessage(), e );
}
return repository;
deleteContent && context.getIndexDirectoryFile().exists() );
}
}
- catch ( PlexusSisuBridgeException e )
- {
- throw new RepositoryAdminException( e.getMessage(), e );
- }
- catch ( IOException e )
+ catch ( PlexusSisuBridgeException | IOException e )
{
throw new RepositoryAdminException( e.getMessage(), e );
}
if ( !stagedOne )
{
- RepositorySession repositorySession = getRepositorySessionFactory().createSession();
- try
+ try (RepositorySession repositorySession = getRepositorySessionFactory().createSession())
{
MetadataRepository metadataRepository = repositorySession.getRepository();
metadataRepository.removeRepository( repository.getId() );
//throw new RepositoryAdminException( e.getMessage(), e );
log.warn( "skip error during removing repository from MetadataRepository:{}", e.getMessage(), e );
}
- finally
- {
- repositorySession.close();
- }
}
config.removeManagedRepository( repository );
auditInformation, getArchivaConfiguration().getConfiguration() );
// Save the repository configuration.
- RepositorySession repositorySession = getRepositorySessionFactory().createSession();
- try
+ try (RepositorySession repositorySession = getRepositorySessionFactory().createSession())
{
triggerAuditEvent( managedRepositoryConfiguration.getId(), null, AuditEvent.MODIFY_MANAGED_REPO,
auditInformation );
{
throw new RepositoryAdminException( e.getMessage(), e );
}
- finally
- {
- repositorySession.close();
- }
if ( updateIndexContext )
{
}
return context;
}
- catch ( MalformedURLException e )
- {
- throw new RepositoryAdminException( e.getMessage(), e );
- }
- catch ( IOException e )
- {
- throw new RepositoryAdminException( e.getMessage(), e );
- }
- catch ( UnsupportedExistingLuceneIndexException e )
+ catch ( IOException | UnsupportedExistingLuceneIndexException e )
{
throw new RepositoryAdminException( e.getMessage(), e );
}
}
catch ( TaskQueueException e )
{
- log.error( "failed to schedule scanning of repo with id {}", repositoryId, e );
+ log.error( "failed to schedule scanning of repo with id " + repositoryId, e );
return false;
}
return true;
*/
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
-import org.apache.archiva.admin.model.beans.RemoteRepository;
import org.apache.archiva.redback.rest.api.model.User;
-import org.apache.archiva.redback.rest.api.services.RoleManagementService;
import org.apache.archiva.redback.rest.api.services.UserService;
import org.apache.archiva.redback.rest.services.AbstractRestServicesTest;
import org.apache.archiva.redback.rest.services.FakeCreateAdminService;
-import org.apache.archiva.remotedownload.AbstractDownloadTest;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
-import org.apache.archiva.security.common.ArchivaRoleConstants;
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
import org.apache.archiva.web.api.FileUploadService;
-import org.apache.archiva.web.api.RuntimeInfoService;
-import org.apache.archiva.web.model.ApplicationRuntimeInfo;
import org.apache.archiva.web.model.FileMetadata;
import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
import org.apache.cxf.message.Message;
import org.apache.cxf.transport.servlet.CXFServlet;
-import org.apache.maven.wagon.providers.http.HttpWagon;
-import org.apache.maven.wagon.repository.Repository;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.After;
-import org.junit.AfterClass;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.slf4j.bridge.SLF4JBridgeHandler;
import org.springframework.web.context.ContextLoaderListener;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.ClientErrorException;
-import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
+import java.sql.DriverManager;
import java.util.Collections;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
/**
* @author Olivier Lamy
System.setProperty( "org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true" );
System.setProperty("appserver.base", Paths.get("target/appserver-base").toAbsolutePath().toString());
Path appServerBase = Paths.get("target/appserver-base");
+ // trying to shutdown derby for file leak
+ DriverManager.getDriver("jdbc:derby:;shutdown=true");
+ // to help cleaning files on Windows....
+ System.gc();
FileUtils.deleteDirectory(appServerBase.toAbsolutePath().toFile());
Path confDir = appServerBase.resolve( "conf" );
if ( !Files.exists(confDir))
if (this.tomcat != null) {
try {
this.tomcat.stop();
- } catch (LifecycleException e) {
- //
+ } catch (Exception e) {
+ log.info("ignore fail to stop Tomcat: " + e.getMessage(), e);
}
}
System.clearProperty( "org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH" );
final Attachment fileAttachment = new AttachmentBuilder( ).object( Files.newInputStream( file ) ).contentDisposition( new ContentDisposition( "form-data; filename=\"" + file.getFileName( ).toString( ) + "\"; name=\"files[]\"" ) ).build( );
MultipartBody body = new MultipartBody( fileAttachment );
service.post( body );
- String relativePathEncoded = URLEncoder.encode( "../target/" + relativePath.toString( ), "UTF-8" );
+ String relativePathEncoded = URLEncoder.encode( "../target/" + relativePath, "UTF-8" );
log.debug( "Trying to delete with path traversal: {}, {}", relativePath, relativePathEncoded );
try
{
</plugin>
</plugins>
</build>
+
+ <profiles>
+ <profile>
+ <id>jdk9+</id>
+ <activation>
+ <jdk>[1.9,)</jdk>
+ </activation>
+ <dependencies>
+ <!-- needed for jdk 11 -->
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
</project>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
+ <trimStackTrace>false</trimStackTrace>
<argLine>${jacocoagent}</argLine>
<redirectTestOutputToFile>${surefire.redirectTestOutputToFile}</redirectTestOutputToFile>
<runOrder>alphabetical</runOrder>
</plugins>
</build>
</profile>
+ <profile>
+ <id>jdk9+</id>
+ <activation>
+ <jdk>[1.9,)</jdk>
+ </activation>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>com.webcohesion.enunciate</groupId>
+ <artifactId>enunciate-maven-plugin</artifactId>
+ <version>${enunciate.version}</version>
+ <dependencies>
+ <!-- needed for jdk 11 -->
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ </profile>
</profiles>
<repositories>