package org.argeo.slc.aether.spring;
+import org.sonatype.aether.repository.Authentication;
import org.sonatype.aether.repository.RemoteRepository;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.FactoryBean;
private String id;
private String url;
private String type = "default";
+ private String username;
+ private String password;
public Object getObject() throws Exception {
- return new RemoteRepository(id != null ? id : beanName, type, url);
+ RemoteRepository remoteRepository = new RemoteRepository(
+ id != null ? id : beanName, type, url);
+ if (username != null) {
+ Authentication authentication = new Authentication(username,
+ password);
+ remoteRepository.setAuthentication(authentication);
+ }
+ return remoteRepository;
}
public Class<?> getObjectType() {
this.type = type;
}
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
}