org.apache.maven.plugin.LegacySupport Java Examples
The following examples show how to use
org.apache.maven.plugin.LegacySupport.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UsageStatisticsManager.java From deadcode4j with Apache License 2.0 | 6 votes |
public static SystemProperties from(LegacySupport legacySupport, MavenRuntime mavenRuntime) { SystemProperties systemProperties = new SystemProperties(); try { MavenProjectProperties projectProperties = mavenRuntime.getProjectProperties(SystemProperties.class); systemProperties.values.put("deadcode4j.version", projectProperties.getVersion()); } catch (MavenRuntimeException e) { LoggerFactory.getLogger(SystemProperties.class).debug("Failed to determine MavenRuntime.", e); } Properties properties = legacySupport.getSession().getRequest().getSystemProperties(); for (String key : KEYS.keySet()) { String property = emptyToNull(properties.getProperty(key)); if (property != null) { systemProperties.values.put(key, property); } } return systemProperties; }
Example #2
Source File: An_UpdateChecker.java From deadcode4j with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { objectUnderTest = new UpdateChecker(); repositoryMetadataManager = mock(RepositoryMetadataManager.class); mavenSession = mock(MavenSession.class); when(mavenSession.getCurrentProject()).thenReturn(new MavenProject()); LegacySupport legacySupport = mock(LegacySupport.class); when(legacySupport.getSession()).thenReturn(mavenSession); ReflectionUtils.setVariableValueInObject(objectUnderTest, "legacySupport", legacySupport); ReflectionUtils.setVariableValueInObject(objectUnderTest, "repositoryMetadataManager", repositoryMetadataManager); }
Example #3
Source File: A_UsageStatisticsManager.java From deadcode4j with Apache License 2.0 | 5 votes |
@SuppressWarnings("deprecation") // there's no non-deprecated constructor for MavenSession :| private void givenModes(NetworkModes networkMode, InteractivityModes interactivity) throws IllegalAccessException { DefaultMavenExecutionRequest mavenExecutionRequest = new DefaultMavenExecutionRequest(); mavenExecutionRequest.setOffline(NetworkModes.OFFLINE == networkMode); mavenExecutionRequest.setInteractiveMode(InteractivityModes.INTERACTIVE == interactivity); mavenExecutionRequest.setSystemProperties(System.getProperties()); LegacySupport legacySupport = mock(LegacySupport.class); when(legacySupport.getSession()).thenReturn(new MavenSession(null, null, mavenExecutionRequest, null)); setVariableValueInObject(objectUnderTest, "legacySupport", legacySupport); }