Mappings cant be generated if one of mapped entity have external dependency.
See original GitHub issueHello, I am facing issue that mapper cant be generated when at least one of the mapped entities have any using, so any external dependency. We are corrently using Mapster:7.4.0-pre06 with MapsterTools:8.4.0-pre.6 due to .NET7 need. We have all the project in .NET7. Corrently we found one workaround and that is that we need to manually copy all the required dependencies to bin folder. Then it works.
We have following error for each dependency: (replace <myDependency> with any dependency you can imagine)
Tool 'mapster.tool' (version '8.4.0-pre06') was restored. Available commands: dotnet-mapster
Restore was successful.
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly '<myDependency>, Version=2.0.1.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: '<myDependency>, Version=2.0.1.0, Culture=neutral, PublicKeyToken=null'
at System.ModuleHandle.ResolveType(QCallModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctorWithParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
at Mapster.Tool.Program.GenerateMappers(MapperOptions opt) in C:\Projects\Mapster\src\Mapster.Tool\Program.cs:line 71
at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
at Mapster.Tool.Program.Main(String[] args) in C:\Projects\Mapster\src\Mapster.Tool\Program.cs:line 18
Issue Analytics
- State:
- Created 3 months ago
- Comments:7
Top Results From Across the Web
Entities not mapped after moving them into external jar ...
The EntityManagerFactory is built for scanning entities only from the jar that has a /META-INF/persistence.xml file into.
Read more >One-Stop Guide to Mapping with MapStruct
We will notice in the generated implementation that MapStruct has automatically created an extra mapping method to convert between the entities ...
Read more >Chapter 2. Mapping Entities
This class, which needs to be Serializable , is declared on the entity via the @IdClass annotation.
Read more >Mapping JPA Entities into DTOs in Spring Boot Using ...
Let's see how to integrate MapStruct into a Spring Boot and Java project to map JPA entities into DTOs with no extra effort....
Read more >Advanced table mapping - EF Core
The dependent entity type cannot use TPC mapping as the derived types wouldn't be able to map to the same table. The dependent...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Something like this I think :
So how should this config looks like? We are using it now with this configuration: