所以基本上,我有一个多模块项目,例如
- ProjectA
|- Module1
|- Module2
Run Code Online (Sandbox Code Playgroud)
相关部分(我相信)pom.xml的ProjectA方法是:
<modelVersion>4.0.0</modelVersion>
<groupId>com.companyName</groupId>
<artifactId>ProjectA</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<modules>
<module>Module1</module>
<module>Module2</module>
</modules>
Run Code Online (Sandbox Code Playgroud)
而pom.xml对于模块1是:
<parent>
<groupId>com.companyName</groupId>
<artifactId>ProjectA</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>Module1</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
Run Code Online (Sandbox Code Playgroud)
而pom.xml依赖于Module1的Module2的如下所示:
<parent>
<groupId>com.companyName</groupId>
<artifactId>ProjectA</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>Module2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.companyName</groupId>
<artifactId>Module1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
...
</dependencies>
Run Code Online (Sandbox Code Playgroud)
我可以很好地构建和安装Module1。我可以在Module2中从中导入类,但是不能使用以下命令编译Module2:Could not find artifact com.companyName:ProjectA:pom:0.0.1-SNAPSHOT
同样,我正在构建另一个项目ProjectB,它将具有Module3。在Module3中pom.xml:
<dependency>
<groupId>com.companyName.ProjectA</groupId>
<artifactId>Module1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
但是,由于com.companyName.ProjectA不可用,我无法将其导入到我的.java文件中,IntelliJ警告我。我究竟做错了什么?我在相关的多模块项目问题中尝试了几乎所有配置。谢谢!
更新:控制台输出已更改为:
[ERROR] COMPILATION ERROR :
[INFO] ------------------------------------------------------------- …Run Code Online (Sandbox Code Playgroud) 这是我的管道settings.py:
SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.social_user',
'social.pipeline.user.get_username',
'accounts.pipeline.create_user',
'accounts.pipeline.update_user_social_data',
# 'social.pipeline.user.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details',
)
Run Code Online (Sandbox Code Playgroud)
以及这一行:
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
Run Code Online (Sandbox Code Playgroud)
我也尝试过这个:
FACEBOOK_EXTENDED_PERMISSIONS = ['email']
Run Code Online (Sandbox Code Playgroud)
在我的pipeline.py:
def create_user(strategy, details, user=None, *args, **kwargs):
if user:
return {
'is_new': False
}
fields = dict((name, kwargs.get(name) or details.get(name))
for name in strategy.setting('USER_FIELDS',
USER_FIELDS))
if not fields:
return
if strategy.session_get('signup') == 'UserType1':
user1 = UserType1.objects.create_user(username=fields.get('username'))
user1.user_type = User.USERTYPE1
user1.save()
return {
'is_new': True,
'user': user1
}
elif strategy.session_get('signup') == 'UserType2': …Run Code Online (Sandbox Code Playgroud) 我有一个相当简单的案例,我试图将 HTTP 标头(不是 SOAP 标头)添加到我使用 Spring 的WebServiceTemplate.
我已经定义了ClientInterceptor我正在做的事情:
@Override
public boolean handleRequest(MessageContext messageContext) throws WebServiceClientException {
try {
TransportContext context = TransportContextHolder.getTransportContext();
HttpComponentsConnection connection = (HttpComponentsConnection) context.getConnection();
connection.addRequestHeader("Authorization", String.format("Bearer %s", someAccessToken));
} catch (IOException exception) {
// Do nothing
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
这是我如何配置我的SomeClient延伸WebServiceConfigurationSupport:
@Bean
public SomeClient someClient() {
...
SomeClientImpl service = new SomeClientImpl();
service.setObjectFactory(new com.path.ObjectFactory());
service.setDefaultUri(someUri);
service.setMarshaller(marshaller);
service.setUnmarshaller(marshaller);
service.setxStreamMarshaller(xStreamMarshaller);
service.setInterceptors(new ClientInterceptor[]{wss4jSecurityInterceptor()});
service.setMessageSender(new HttpComponentsMessageSender());
service.setInterceptors(new ClientInterceptor[]{wss4jSecurityInterceptor(), addHttpHeaderInterceptor()});
return service;
}
@Bean …Run Code Online (Sandbox Code Playgroud) 我的控制器中有这个方法:
@RequestMapping(method = RequestMethod.POST)
InterfaceClass insert(@RequestBody InterfaceClass interfaceClass) {
// Do something
}
Run Code Online (Sandbox Code Playgroud)
我得到的错误非常简单且不言自明:
Can not construct instance of InterfaceClass: abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information.
Run Code Online (Sandbox Code Playgroud)
基本上,我要告诉Spring,我有一个具体的实现InterfaceClass,ClassImpl。
我试过:
@JsonRootName("InterfaceClass")
public class ClassImpl implements InterfaceClass {
}
Run Code Online (Sandbox Code Playgroud)
没有任何程度。我不能使用@JsonTypeInfo 作为父接口的类InterfaceClass不应该知道ClassImpl并且它们在不同的模块中。我也尝试过:
实施InterfaceClass抽象AbstractClass和认沽:
@JsonDeserialize(as = AbstractClass.class)
Run Code Online (Sandbox Code Playgroud)
在InterfaceClass. 然后,延长AbstractClass使用ClassImpl。错误只是变成:
Can not construct instance …Run Code Online (Sandbox Code Playgroud) UserGetResponse和GeneralResponse是BaseResponse的子类,如下所示:
abstract class BaseResponse()
Run Code Online (Sandbox Code Playgroud)
我用来检索用户的函数如下:
def userGet(userId: Int)(implicit ec: ExecutionContext): Future[BaseResponse] = Future {
val response = users.get(userId) map { user =>
val userRes = new UserResponse(user.id, user.firstname, user.lastname, user.organisationid, user.email, user.password, user.usertype)
new UserGetResponse(1, "Successful retrieved the user.", userRes)
} getOrElse {
GeneralResponse(0, s"Error retrieving user. User does not exist.")
}
}
Run Code Online (Sandbox Code Playgroud)
其中users是另一个定义了get,insert等方法的类.我收到以下编译错误:
type mismatch;
[error] found : Unit
[error] required: package.name.BaseResponse
[error] }
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?